Subselect returns too many attributes - Mailing list pgsql-novice

From Scott Muir
Subject Subselect returns too many attributes
Date
Msg-id NCBBKLMCJOGCLFHOFECNAEHCDLAA.wsmuir@islandnet.com
Whole thread Raw
Responses Re: Subselect returns too many attributes
List pgsql-novice
Here is an interesting one..

I'm trying to perform the following.. this is a simpler version of what I"m
actually working with..

SELECT p.name, c.mostrecentthingbought FROM parent p, child c WHERE c.name =
p.name AND c.tx_number = ANY( SELECT MAX(c.tx_number) AS "max" FROM child c
WHERE c.name = p.name GROUP BY c.name);

i think that is pretty close.. though in my case there are 4 fields in the
parent primary key and 5 in the child...

anyways, this is a view which I am storing..  when I store it, pgsql takes
it happily.. both from pgacces and psql...

when I view it again either from pgaccess or using psql, the subselect has
had added to the fields it returns, all the other fields in the group by or
in the where clause...  this still seems to work okay..

though if I want to modify the view, i have to remove the extra fields in
order for it to get back in, and it promptly replaces them anyways..

So the question is, do the ANY clause have an actual problem with the
subselect returning more than one field (attribute whatever)???


Thanks.
Scott.


pgsql-novice by date:

Previous
From: Richard Ehrlich
Date:
Subject: Configuration Parameters
Next
From: Tom Lane
Date:
Subject: Re: Subselect returns too many attributes