Re: "Unvisible" duplicates in SELECT [...] HAVING count(attrib) > 1 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: "Unvisible" duplicates in SELECT [...] HAVING count(attrib) > 1
Date
Msg-id 15653.990198747@sss.pgh.pa.us
Whole thread Raw
In response to "Unvisible" duplicates in SELECT [...] HAVING count(attrib) > 1  (Krzysztof Gajdemski <songo@vi.pl>)
Responses Re: "Unvisible" duplicates in SELECT [...] HAVING count(attrib) > 1  (Krzysztof Gajdemski <songo@vi.pl>)
List pgsql-bugs
Krzysztof Gajdemski <songo@vi.pl> writes:
>   PostgreSQL version (example: PostgreSQL-7.1):   PostgreSQL-7.1rc4

> query doesn't produce reliable results for some specific circumstances

I tried your example in current sources and get reasonable-looking
behavior:

regression=#  SELECT nick FROM user_id GROUP BY nick HAVING count(nick) > 1;
        nick
--------------------
 dr dre\$\$\$\$\$\$
 sexylady\@
(2 rows)

regression=# DELETE FROM user_id WHERE nick IN (
regression(# SELECT nick FROM user_id GROUP BY nick HAVING count(nick) > 1);
DELETE 4
regression=# SELECT nick FROM user_id GROUP BY nick HAVING count(nick) > 1;
 nick
------
(0 rows)

regression=# CREATE UNIQUE INDEX nick_idx ON user_id(nick);
CREATE
regression=# SELECT nick FROM user_id WHERE nick LIKE 'dr dre%';
 nick
------
(0 rows)

regression=# SELECT nick FROM user_id GROUP BY nick HAVING count(nick) > 1;
 nick
------
(0 rows)

regression=#

It could be that there's a locale dependency here (I did this in a
non-locale-enabled compilation), but I think it's more likely that
you've run into one of the complex-query bugs we corrected since rc4.
Please update to 7.1.1 (or better 7.1.2, which should be out very soon)
and see if you still see a problem.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Krzysztof Gajdemski
Date:
Subject: "Unvisible" duplicates in SELECT [...] HAVING count(attrib) > 1
Next
From: Tom Lane
Date:
Subject: Re: Problems with avg on interval data type