Re: Select + Functions + Composite Types: Behavior

From: "David Johnston" <polobo(at)yahoo(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select + Functions + Composite Types: Behavior
Date: 2011-02-12 23:49:36
Message-ID: 01ea01cbcb0f$81de5250$859af6f0$@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom,

BTW, with the quick response you provided (THANKS!) I probably should have
pinged the list sooner in my search...

David J.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Saturday, February 12, 2011 5:33 PM
To: David Johnston
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Select + Functions + Composite Types: Behavior

"David Johnston" <polobo(at)yahoo(dot)com> writes:
> If I put a function that returns a composite type into the FROM clause
> of a SELECT query (and it - the function - is the only source for the
> query) the "*" select list expands so that there is a single record
> for each component of the composite type.

> SELECT * FROM compositereturningfunction() Yields -> 2 columns (one
> for id and one for data)

> I've read quite a bit about plpgsql and composite types and do not
> recall anything about this specific default behavior and methods to
> force
> (workaround) to the other behavior.

It's just like tables. Try

select x from compositereturningfunction() x

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-02-13 00:08:48 Re: Select + Functions + Composite Types: Behavior
Previous Message David Johnston 2011-02-12 23:47:06 Re: Select + Functions + Composite Types: Behavior