Re: [GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Max Zorloff
On Thu, 29 Nov 2007 21:15:50 +0400, Rodrigo De León <[EMAIL PROTECTED]> wrote: On Nov 29, 2007 9:33 AM, Max Zorloff <[EMAIL PROTECTED]> wrote: I don't think that works. ponline=# select ('{1,2,3}'::text)::int[]; ERROR: cannot cast type text to integer[] Can you try: select ('{1,2,3}'::un

Re: [GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Max Zorloff
On Thu, 29 Nov 2007 19:21:03 +0400, Pavel Stehule <[EMAIL PROTECTED]> wrote: Hello arrays in PostgreSQL have to be regular allways. And before 8.3 array cannot contais NULL, so you cannot simpl resize two dim array :(. But your functions doesn't work in 8.3. too. So you can a) use 1D array a

Re: [GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Max Zorloff
On Thu, 29 Nov 2007 18:11:22 +0400, Rodrigo De León <[EMAIL PROTECTED]> wrote: On Nov 29, 2007 3:34 AM, Max Zorloff <[EMAIL PROTECTED]> wrote: According to the docs it seems that only way would be to declare it as something like : myArray := ARRAY[[1,2], [3,4], [5,6]]; You can declare arbit

Re: [GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Rodrigo De León
I wrote: > You can declare arbitrary-sized, n-dimensional arrays: Sorry, I re-read your post. You want to programatically define the array dimensions depending on function arguments. You could try building a string, then casting to the correct array type (not tested). --

Re: [GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Rodrigo De León
On Nov 29, 2007 3:34 AM, Max Zorloff <[EMAIL PROTECTED]> wrote: > According to the docs it seems that only way would be to declare it as > something like : > myArray := ARRAY[[1,2], [3,4], [5,6]]; You can declare arbitrary-sized, n-dimensional arrays: ... DECLARE myArray integer[][]; -- two-dime

[GENERAL] Declaring multidimensional arrays in pl/pgsql

2007-11-29 Thread Max Zorloff
Hi, all. I was wondering, can I really declare a 2-dimensional array of arbitrary size in pl/pgsql? According to the docs it seems that only way would be to declare it as something like : myArray := ARRAY[[1,2], [3,4], [5,6]]; But what if I pass the dimensions as function parameters? My po