Skip site navigation (1) Skip section navigation (2)

uniqueness not always correct

From: Frank Cusack <fcusack(at)iconnet(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: uniqueness not always correct
Date: 1999-11-11 09:14:03
Message-ID: 199911110914.BAA06525@yem.jsv.qwest.net (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Solaris 2.6/sparc; postgres 6.5.1

dns=> create table test (zone int4, net cidr, unique(zone, net));
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 'test_zone_key' for table 'test'
CREATE
dns=> insert into test (zone, net) values (1, '1.2.3/24');
INSERT 21750 1
dns=> insert into test (zone, net) values (1, '2.3.4/24');
INSERT 21751 1
dns=> insert into test (zone, net) values (1, '1.2.3/24');
INSERT 21752 1
dns=> insert into test (zone, net) values (1, '2.3.4/24');
ERROR:  Cannot insert a duplicate key into a unique index
dns=> select * from test;
zone|net     
- ----+--------
   1|1.2.3/24
   1|2.3.4/24
   1|1.2.3/24
(3 rows)


Once a unique error is reported, uniqueness seems to be maintained.
Also, if you enter 4 values, then try a duplicate, it all works.

The threshold seems to be 3.

A select before the duplicate add also seems to fix it.

~f



Responses

pgsql-hackers by date

Next:From: Vadim MikheevDate: 1999-11-11 10:07:25
Subject: Re: [BUGS] uniqueness not always correct
Previous:From: Tom LaneDate: 1999-11-11 06:18:11
Subject: Re: [HACKERS] Arrays broken on temp tables

pgsql-bugs by date

Next:From: Vadim MikheevDate: 1999-11-11 10:07:25
Subject: Re: [BUGS] uniqueness not always correct
Previous:From: Frank CusackDate: 1999-11-11 09:04:31
Subject:

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group