Subselect returns too many attributes

From: "Scott Muir" <wsmuir(at)islandnet(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Subselect returns too many attributes
Date: 2001-03-24 01:52:10
Message-ID: NCBBKLMCJOGCLFHOFECNAEHCDLAA.wsmuir@islandnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2001-03-24 02:34:03 Re: Subselect returns too many attributes
Previous Message Richard Ehrlich 2001-03-24 00:00:44 Configuration Parameters