unique constraint - bug?

Поиск
Список
Период
Сортировка
От Merrill Oveson
Тема unique constraint - bug?
Дата
Msg-id 39762A1F.B5089BED@actiontarget.com
обсуждение исходный текст
Ответы Re: unique constraint - bug?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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






В списке pgsql-general по дате отправления:

Предыдущее
От: "Swaminathan R. Iyer"
Дата:
Сообщение: Retrieving images from PG using Java
Следующее
От: "Joel Burton"
Дата:
Сообщение: Re: Does CREATE FUNCTION... WITH (ISCACHABLE) work?