Subselect returns too many attributes

Поиск
Список
Период
Сортировка
От Scott Muir
Тема Subselect returns too many attributes
Дата
Msg-id NCBBKLMCJOGCLFHOFECNAEHCDLAA.wsmuir@islandnet.com
обсуждение исходный текст
Ответы Re: Subselect returns too many attributes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Richard Ehrlich
Дата:
Сообщение: Configuration Parameters
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Subselect returns too many attributes