=ANY bug

Started by Sferacarta Softwareover 27 years ago2 messageshackers
Jump to latest
#1Sferacarta Software
sferac@bo.nettuno.it

Hi all,

Because IN is semantically identical to =ANY
here the same error using ANY:

select * from emp where ename =ANY (
select ename from emp group by ename having 1 < count(ename)
);
ename |empno|job | hiredate|sal |comm|deptno|level| mgr
------+-----+----------+----------+---------+----+------+-----+----
ALLEN | 7499|SALESMAN |1981-02-20|$1,600.00| 300| 20| 4|7782
BLAKE | 7698|MANAGER |1981-05-01|$2,850.00| | 30| 3|7782
JONES | 7900|CLERK |1981-12-03|$950.00 | | 30| 2|7782
MILLER| 7654|SALESMAN |1981-09-28|$1,250.00| 400| 30| 3|7839
CLARK | 7844|SALESMAN |1981-09-08|$1,500.00| | 10| 2|7839
KING | 7521|SALESMAN |1981-02-22|$1,250.00| 500| 10| 1|7782
ALLEN | 7499|SALESMAN |1981-02-20|$1,600.00| 300| 20| 4|7782
BLAKE | 7698|MANAGER |1981-05-01|$2,850.00| | 30| 3|7782
(8 rows)

but I expect the following instead:

ename |empno|job | hiredate|sal |comm|deptno|level| mgr
------+-----+----------+----------+---------+----+------+-----+----
ALLEN | 7499|SALESMAN |1981-02-20|$1,600.00| 300| 20| 4|7782
BLAKE | 7698|MANAGER |1981-05-01|$2,850.00| | 30| 3|7782
ALLEN | 7499|SALESMAN |1981-02-20|$1,600.00| 300| 20| 4|7782
BLAKE | 7698|MANAGER |1981-05-01|$2,850.00| | 30| 3|7782
(4 rows)

-Jose'-

#2Bruce Momjian
bruce@momjian.us
In reply to: Sferacarta Software (#1)
Re: [HACKERS] =ANY bug

Hi all,

Because IN is semantically identical to =ANY
here the same error using ANY:

select * from emp where ename =ANY (
select ename from emp group by ename having 1 < count(ename)
);

Can I just say that using HAVING inside a subquery is buggy? Vadim, was
this already fixed?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026