Bruce Momjian wrote:
... >> >> bray=> select rcname, rcsrc from pg_relcheck where rcrelid = >> >> '115404'::oid and rcrelid in (select
min(rcrelid)from pg_relcheck >> >> group by rcname); ERROR: parser: Subselect has too many or too >> >> few
fields.>> >> >> >> The subselect only produces one column; so I think that the >> >> error message is wrong. >>
> >> >What is the GROUP BY doing?
...
>Maybe I should be clearer. You are grouping by a column that is not in >the target list. If you try the subquery on
itsown, it should fail >with a better error message.
It doesn't fail; it produces the results I want.
bray=> select min(rcrelid) from pg_relcheck group by rcname; min ------ 115940 115026 115026 115026 ... etc ...
Any way, why should it be an error to group by a column that is not in the
results list, if the results list comprises aggregates only?
(Mind you, I think I have not yet got a reliable way of finding the
ultimate ancestor of an inherited constraint. Is it actually possible to
do this with queries or do we have to add a boolean flag to pg_relcheck
to be set where the constraint is/is not inherited?)
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver PGP key from public servers; key
ID32B8FAA1 ======================================== "Jesus saith unto him, I am the way, the truth,
andthe life; no man cometh unto the Father, but by me." John 14:6