Re: BUG #1698: Different behavior in UNIQUE and DISTINCT - Mailing list pgsql-bugs

From Mauro Delfino
Subject Re: BUG #1698: Different behavior in UNIQUE and DISTINCT
Date
Msg-id 8d465be205061306124d947056@mail.gmail.com
Whole thread Raw
In response to Re: BUG #1698: Different behavior in UNIQUE and DISTINCT  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: BUG #1698: Different behavior in UNIQUE and DISTINCT
List pgsql-bugs
Yes I'm sure. I was created right before filling it.
Thanks,
Mauro
 2005/6/3, Bruno Wolff III <bruno@wolff.to>:=20
>=20
> On Thu, Jun 02, 2005 at 20:22:07 +0100,
> Mauro Delfino <maurodelfino@gmail.com> wrote:
> >
> > I have the these two tables:
> > CREATE TABLE table_one
> > ( field1 VARCHAR(255) );
> >
> > CREATE TABLE table_two
> > ( field1 VARCHAR(255) UNIQUE );
> >
> > table_one has 500k records. I certify that all strings are distinct with
> > this query:
> > SELECT DISTINCT field1 FROM table_one;
> > The query results 500k rows.
> >
> > But if I try to insert the records of table_one into table_two with the
> > following command:
> > INSERT INTO table_two (field1) (SELECT field1 FROM table_one);
> > This error occurs:
> > ERROR: duplicate key violates unique constraint "table_two_field1_key"
> >
> > What happened? DISTINC and UNIQUE have different algorithms to determine
> > when two strings are equal?
>=20
> Are you sure table_two is empty when you do this?
>=20



--=20
Mauro Delfino=20
maurodelfino@gmail.com=20
(48) 9933-6933
(MCDBA/MCSE/MCP+I/IBM Lotus CLS)=20
Microsoft SQL Server Official Beta Tester

pgsql-bugs by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: BUG #1712: JDBC column precision for bigint is 0
Next
From: Klint Gore
Date:
Subject: Re: BUG #1698: Different behavior in UNIQUE and DISTINCT