Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

Next:From: Tom LaneDate: 2001-03-24 02:34:03
Subject: Re: Subselect returns too many attributes
Previous:From: Richard EhrlichDate: 2001-03-24 00:00:44
Subject: Configuration Parameters

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group