Re: [GENERAL] generic way to retrieve array as rowset

2006-01-04 Thread SunWuKung
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > > SunWuKung <[EMAIL PROTECTED]> writes: > > > Thank you both, I will make good use of this. > > > > On a side note: isn't it a pity this has to be so difficult? > > It doesn't have to be. > > Look in the contrib directory, build the i

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 18:19:12 -0500 mailte Greg Stark folgendes: > Look in the contrib directory, build the intagg module (or if you use debian > install the postgresql-contrib package) and then: > > SELECT id, int_array_enum(val) FROM t7 Cool, it works perfectly. Andreas -- Andreas Kretschmer

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread Greg Stark
SunWuKung <[EMAIL PROTECTED]> writes: > Thank you both, I will make good use of this. > > On a side note: isn't it a pity this has to be so difficult? It doesn't have to be. Look in the contrib directory, build the intagg module (or if you use debian install the postgresql-contrib package) and

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread Klein Balázs
manipulate this datatype. regards, Balázs -Original Message- From: Tino Wildenhain [mailto:[EMAIL PROTECTED] Sent: 2006. január 3. 18:59 To: SunWuKung Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] generic way to retrieve array as rowset SunWuKung schrieb: > Thank you both, I w

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread Andreas Kretschmer
Tino Wildenhain <[EMAIL PROTECTED]> schrieb: > *wink* ;) > Tino hehe ;-) Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread Tino Wildenhain
SunWuKung schrieb: > Thank you both, I will make good use of this. > > On a side note: isn't it a pity this has to be so difficult? Well the pity is your data model - or the lack of it ;)) If redesign is possible, you probably want to change from array to real connected table. *wink* ;) Tino --

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread SunWuKung
Thank you both, I will make good use of this. On a side note: isn't it a pity this has to be so difficult? Balázs In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > am 03.01.2006, um 16:42:08 +0200 mailte Volkan YAZICI folgendes: > > Hi, > > > > Here's a modified version of A. Kretsc

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 16:42:08 +0200 mailte Volkan YAZICI folgendes: > Hi, > > Here's a modified version of A. Kretschmer's answer. This one checks > array_upper() sizes and depending on it, doesn't provide unnecessary > NULL fields. HTH. > > SELECT id, val[s.i] > FROM t7 > LEFT JOIN > (SELECT

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread Volkan YAZICI
Hi, Here's a modified version of A. Kretschmer's answer. This one checks array_upper() sizes and depending on it, doesn't provide unnecessary NULL fields. HTH. SELECT id, val[s.i] FROM t7 LEFT JOIN (SELECT g.s FROM generate_series(1, (SELECT max(arr

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 13:24:54 +0100 mailte SunWuKung folgendes: > Unfortunately the number of elements in the array is not known > beforehand. The dimension of the array is always 1, but the number of > elements changes from 50-500. Okay. test=# select * from t1; id | foo +

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread SunWuKung
Unfortunately the number of elements in the array is not known beforehand. The dimension of the array is always 1, but the number of elements changes from 50-500. I looked at the article you mention and it creates a set returning function. I found some functions like that in the archive - like

Re: [GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread A. Kretschmer
am 03.01.2006, um 12:37:51 +0100 mailte SunWuKung folgendes: > When storing data in an array, like this > > idarray > 1,{1,2} > 2,{10,20} > 3,{100,200} Forever 2 Elements in the array? Then: test=# select * from t1; id |foo +--- 1 | {1,2} 2 | {10,20} 3 | {

[GENERAL] generic way to retrieve array as rowset

2006-01-03 Thread SunWuKung
When storing data in an array, like this id array 1, {1,2} 2, {10,20} 3, {100,200} is there a generic way to retrieve them as arowset, like this id array_dimension1 1 1 1 2 2 10 2 20 By writing something like this: Select id, explode(array) From