Re: [GENERAL] Why am I getting doubles? - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] Why am I getting doubles?
Date
Msg-id 25395.1501214986@sss.pgh.pa.us
Whole thread Raw
In response to [GENERAL] Why am I getting doubles?  (Igor Korot <ikorot01@gmail.com>)
List pgsql-general
Igor Korot <ikorot01@gmail.com> writes:
> Is there a reason I'm seeing duplicate records on the query above?

Your example isn't complete, but I think the problem is your
WHERE clause isn't equating enough columns.  For instance,
if I do

db=# create table pp(f1 int, f2 int, primary key (f1,f2));
CREATE TABLE

that produces two rows in information_schema.key_column_usage:

 db                 | public            | pp_pkey         | db            | public       | pp         | f1          |
            1 |                               
 db                 | public            | pp_pkey         | db            | public       | pp         | f2          |
            2 |                         

Your WHERE clause can't tell the difference between these.

            regards, tom lane


pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: [GENERAL] Why am I getting doubles?
Next
From: Tim Uckun
Date:
Subject: Re: [GENERAL] Developer GUI tools for PostgreSQL