From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | bhirt(at)mobygames(dot)com |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] IN clause and INTERSECT not behaving as expected |
Date: | 1999-11-11 02:56:42 |
Message-ID: | 13418.942289002@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Brian Hirt <bhirt(at)mobygames(dot)com> writes:
> /* QUERY 1: this query works */
> select id from test1;
> /* QUERY 2: this query works */
> select id from test2 group by id having count(fk) = 2;
> /* QUERY 3: intersected, the queries fail with:
> * ERROR: SELECT/HAVING requires aggregates to be valid
> * NOTE: reversing the order of the intersection works */
> select id from test1
> intersect
> select id from test2 group by id having count(fk) = 2;
> /* QUERY 4: using "QUERY 2" as an in clause you get a more confusing error:
> * ERROR: rewrite: aggregate column of view must be at rigth side in qual */
> select id from test1 where id in
> (select id from test2 group by id having count(fk) = 2);
These are both bugs, I think. I committed rewriter fixes that take care
of query 4 (the rewriter mistakenly thought that having count(*) inside
WHERE was a bad thing even if the aggregate function was inside a
subselect). I am not seeing any failure from query 3 either in current
sources, though I am not sure if that was the same bug or a different one.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-11-11 03:13:28 | Re: [HACKERS] What is nameout() for? |
Previous Message | Tom Lane | 1999-11-11 02:40:57 | Re: AW: [HACKERS] Re: [GENERAL] users in Postgresql |