unique constraint - bug?

From: Merrill Oveson <merrill(at)actarg(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Kyle Bateman <kyle(at)actiontarget(dot)com>
Subject: unique constraint - bug?
Date: 2000-07-19 22:22:23
Message-ID: 39762A1F.B5089BED@actiontarget.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

All:

Run the following script:

drop table letter;
create table letter (
a char(1),
b char(1),
c char(1),
unique (a, b, c)
);

insert into letter values('1','2','3');
insert into letter values('1','2','3');

insert into letter (a,c) values ('1','3');
insert into letter (a,c) values ('1','3');

Notice that the second insert of ('1','2','3') yields an error message,
which is the correct behavior - (that is the unique constaint is
working),
while the last insert of ('1','3') does not yield an error message -
(that is
the unique constraint doesn't work in this case - I think it should).

It appears as though the null value inserted for column b causes an
abrogation
of the unique constaint.

Is this intended or is it a bug?
Or should I be doing something different?

Thanks

Merrill

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joel Burton 2000-07-19 22:50:24 Re: Does CREATE FUNCTION... WITH (ISCACHABLE) work?
Previous Message Swaminathan R. Iyer 2000-07-19 21:16:09 Retrieving images from PG using Java