Re: [HACKERS] Parser bug?

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: olly(at)lfix(dot)co(dot)uk (Oliver Elphick), hackers(at)postgreSQL(dot)org, lockhart(at)alumni(dot)caltech(dot)edu
Subject: Re: [HACKERS] Parser bug?
Date: 1998-11-24 08:11:50
Message-ID: 199811240811.IAA27477@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 its own, 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(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"Jesus saith unto him, I am the way, the truth, and the
life; no man cometh unto the Father, but by me."
John 14:6

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dirk Lutzebaeck 1998-11-24 09:04:47 Fw: rule plan string too big.
Previous Message Thomas G. Lockhart 1998-11-24 05:57:12 Re: [HACKERS] cvs problem