Re: [BUGS] uniqueness not always correct

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Frank Cusack <fcusack(at)iconnet(dot)net>
Cc: pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: [BUGS] uniqueness not always correct
Date: 1999-12-16 01:29:10
Message-ID: 199912160129.UAA11652@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Someone submitted this patch. It should fix your problem. It will
appear in the next release.

> 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
>
>
>
> ************
>
>

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

Attachment Content-Type Size
unknown_filename text/plain 0 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 1999-12-16 01:29:31 Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Previous Message Daniel Boyd 1999-12-15 19:26:54 [PATCHES] Ethernet MAC bug.

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-12-16 01:29:31 Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Previous Message Bruce Momjian 1999-12-16 01:25:07 Re: [HACKERS] pg_dump --help