Re: [HACKERS] having and union in v7beta - Mailing list pgsql-hackers

From Jose Soares
Subject Re: [HACKERS] having and union in v7beta
Date
Msg-id 38BB7E2F.C481BBC3@sferacarta.com
Whole thread Raw
In response to having and union in v7beta  (Jose Soares <jose@sferacarta.com>)
Responses Re: [HACKERS] having and union in v7beta  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane wrote:

> Jose Soares <jose@sferacarta.com> writes:
> > SELECT...HAVING, this last for example doesn't work.
>
> That's a rather strong statement, and in fact a provably false one.
> How about a detailed bug report rather than "it doesn't work"?
>
> > SELECT ... UNION (is 3 / 4 times slow)
>
> Can't help you on that without more details, either.  What is the
> query exactly, what plan does EXPLAIN show, and what plan did you
> get from 6.5?
>
>                         regards, tom lane

--
Jose' Soares
Bologna, Italy                     Jose@sferacarta.com

============================================================================                       POSTGRESQL BUG
REPORTTEMPLATE
 
============================================================================

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.

pgsql-hackers by date:

Previous
From: Jose Soares
Date:
Subject: Re: [HACKERS] having and union in v7beta
Next
From: Hannu Krosing
Date:
Subject: Re: [HACKERS] Re: ALTER TABLE DROP COLUMN