Re: Why am I getting doubles?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Igor Korot <ikorot01(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why am I getting doubles?
Date: 2017-07-28 04:09:46
Message-ID: 25395.1501214986@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Igor Korot <ikorot01(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tim Uckun 2017-07-28 04:31:06 Re: Developer GUI tools for PostgreSQL
Previous Message Igor Korot 2017-07-28 03:52:29 Why am I getting doubles?