Search Postgresql Archives

Re: Returning a row from a function with an appended array field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/10/2011 12:05 PM, David Johnston wrote:
> -----Original Message-----
> From: pgsql-general-owner@xxxxxxxxxxxxxx
> [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Wes Cravens
> Sent: Thursday, November 10, 2011 11:54 AM
> To: pgsql-general@xxxxxxxxxxxxxx
> Subject: Re:  Returning a row from a function with an appended
> array field
> 
> On 11/9/2011 7:19 PM, Wes Cravens wrote:
>> I have an adjacency list kind of table
>>
>> CREATE TABLE thingy (
>> 	id int,
>> 	parent int
>> );
>>
>> I'd like to be able to write a procedural function that returns a row 
>> or rows from this table with an appended field that represents the
> children.
> 
> 
> If you only care about one level of hierarchy then, yes, WITH RECURSIVE is
> overkill.  You want to use WITH RECURSIVE in those situations where the
> depth of the hierarchy is unknown.

Yes agreed... WITH RECURSIVE would be handy for something like
get_ancestors or get_descendents.

Wes

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux