Re: [GENERAL] Selecting from table into an array var

2009-12-21 Thread Merlin Moncure
On Sat, Dec 19, 2009 at 7:08 PM, Postgres User wrote: > Great call, someone did hose the data.  Oddly enough the circular > reference caused no problem when running the stand alone recursive SQL > (with clause). > no problem. I would advise guarding against circular dependencies either with a tr

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Postgres User
Great call, someone did hose the data. Oddly enough the circular reference caused no problem when running the stand alone recursive SQL (with clause). On Sat, Dec 19, 2009 at 10:41 AM, Merlin Moncure wrote: > On Sat, Dec 19, 2009 at 1:30 PM, Postgres User > wrote: >> >> Thanks, your syntax does

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Merlin Moncure
On Sat, Dec 19, 2009 at 1:30 PM, Postgres User wrote: > > Thanks, your syntax does compile and run. > > This is where it gets interesting.  With your syntax (and variations > of it), I'm able to successfully compile and execute.  However, as > soon as I add a dozen rows to the table, the query fai

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Postgres User
On Sat, Dec 19, 2009 at 6:56 AM, Merlin Moncure wrote: > On Sat, Dec 19, 2009 at 1:05 AM, Postgres User > wrote: >> >> BEGIN >> SELECT array_agg(category_id) INTO cat_list FROM ( >>         WITH RECURSIVE subcategory AS >>                ( >>                SELECT * FROM category >>              

Re: [GENERAL] Selecting from table into an array var

2009-12-19 Thread Merlin Moncure
On Sat, Dec 19, 2009 at 1:05 AM, Postgres User wrote: > > BEGIN > SELECT array_agg(category_id) INTO cat_list FROM ( >         WITH RECURSIVE subcategory AS >                ( >                SELECT * FROM category >                WHERE category_id = p_category_id > >                UNION ALL >

Re: [GENERAL] Selecting from table into an array var

2009-12-18 Thread Postgres User
On Fri, Dec 18, 2009 at 9:53 PM, Merlin Moncure wrote: > On Fri, Dec 18, 2009 at 11:35 PM, Pavel Stehule > wrote: >> 2009/12/19 Postgres User : >>> Hi, >>> >>> I'm trying to write a very simple function statement to select a >>> single integer field from a table and save it into an int array. Fo

Re: [GENERAL] Selecting from table into an array var

2009-12-18 Thread Merlin Moncure
On Fri, Dec 18, 2009 at 11:35 PM, Pavel Stehule wrote: > 2009/12/19 Postgres User : >> Hi, >> >> I'm trying to write a very simple function statement to select a >> single integer field from a table and save it into an int array. For >> some reason I can't seem to find the correct syntax: >> >> CR

Re: [GENERAL] Selecting from table into an array var

2009-12-18 Thread Pavel Stehule
2009/12/19 Postgres User : > Hi, > > I'm trying to write a very simple function statement to select a > single integer field from a table and save it into an int array. For > some reason I can't seem to find the correct syntax: > > CREATE TABLE sample ( >    id  integer > ); > > and then within a f

[GENERAL] Selecting from table into an array var

2009-12-18 Thread Postgres User
Hi, I'm trying to write a very simple function statement to select a single integer field from a table and save it into an int array. For some reason I can't seem to find the correct syntax: CREATE TABLE sample ( id integer ); and then within a function: my_array int[]; my_array = SELECT A