Re: [HACKERS] subselects in the target list

2005-02-02 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > On Wed, 2005-02-02 at 23:22 -0500, Tom Lane wrote: >> The syntax you are showing is designed >> to return a scalar. It will (and should) barf on multiple rows as well >> as multiple columns. > I don't understand; the example I posted is of an SRF that ret

Re: [HACKERS] subselects in the target list

2005-02-02 Thread Neil Conway
On Wed, 2005-02-02 at 23:22 -0500, Tom Lane wrote: > The syntax you are showing is designed > to return a scalar. It will (and should) barf on multiple rows as well > as multiple columns. I don't understand; the example I posted is of an SRF that returns multiple rows of multiple columns, which i

Re: [HACKERS] subselects in the target list

2005-02-02 Thread John Hansen
On Wed, 2005-02-02 at 23:22 -0500, Tom Lane wrote: > Neil Conway <[EMAIL PROTECTED]> writes: > > neilc=# select a, (select * from abc) from abc; > > ERROR: subquery must return only one column > > > Is there a reason we can't treat a subselect in the target list as > > returning a composite type?

Re: [HACKERS] subselects in the target list

2005-02-02 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > neilc=# select a, (select * from abc) from abc; > ERROR: subquery must return only one column > Is there a reason we can't treat a subselect in the target list as > returning a composite type? Given the 8.0 infrastructure for unnamed record types it migh

[HACKERS] subselects in the target list

2005-02-02 Thread Neil Conway
This behavior seems inconsistent: neilc=# create table abc (a int, b int); CREATE TABLE neilc=# create function foo_abc() returns setof abc as 'select * from abc' language sql; CREATE FUNCTION neilc=# insert into abc values (5, 10); INSERT 17234 1 neilc=# insert into abc values (10, 20); INSERT 17