having1.err
text/plain
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Jose' Soares
Your email address : Jose@SferaCarta.com
System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium
Operating System (example: Linux 2.0.26 ELF) : Linux 2.0.37 Elf
PostgreSQL version (example: PostgreSQL-6.1) : PostgreSQL-v7.0
Compiler used (example: gcc 2.7.2) : gcc 2.7.2.3
Please enter a FULL description of your problem:
------------------------------------------------
Seems that I found a bug on HAVING clause
Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
I created a table like this one below:
CREATE TABLE comuni (
istat CHAR(06) PRIMARY KEY NOT NULL,
nome CHAR(50) NOT NULL,
provincia CHAR(02),
codice_fiscale CHAR(04),
cap CHAR(05),
regione CHAR(03),
distretto CHAR(04)
);
CREATE INDEX nome_comune_idx ON comuni (nome);
I tried the following query :
select * from comuni where nome in (
select nome from comuni group by nome having 1 < count(nome)
);
on the above table populated with 8342 rows, PostgreSQL begins searching
and I wait for hours without any result.
If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
I don't know, but I can send you my table data if you want it.