BUG #6669: unique index w/ multiple columns and NULLs
| От | jose.soares@sferacarta.com |
|---|---|
| Тема | BUG #6669: unique index w/ multiple columns and NULLs |
| Дата | |
| Msg-id | E1SZxsy-0001GO-JW@wrigleys.postgresql.org обсуждение исходный текст |
| Ответы |
Re: BUG #6669: unique index w/ multiple columns and NULLs
|
| Список | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 6669
Logged by: jose soares
Email address: jose.soares@sferacarta.com
PostgreSQL version: 8.4.8
Operating system: x86_64-pc-linux-gnu, debian
Description:=20=20=20=20=20=20=20=20
Hi,
I think I have found an error in pg or at least inconsistency, take a look
at this.
I created an unique index on two columns and pg let me enter repeated values
as NULLs (unknown value),
When I ask pg to tell me if there are repetitions n this index (with group
by),
the inconsistency becomes apparent.
# create table test(id int, data date, code int);
CREATE TABLE
# create UNIQUE index unica on test(data,code);
CREATE INDEX
# \d test
Table "public.test"
Column | Type | Modifiers
--------+---------+-----------
id | integer |
data | date |
code | integer |
Indexes:
"unica" UNIQUE, btree (data, code)
# insert into test values(1,current_date);
INSERT 0 1
# insert into test values(2,current_date);
INSERT 0 1
# insert into test values(3,current_date);
INSERT 0 1
sicer_forli=3D# select current_date,code, count(*) from test group by 1,2;
date | code | count
------------+------+-------
31-05-2012 | | 3
(1 row)
ps:
Oracle don't allows to insert two NULLs in such column.
I don't know which of them is SQL Standard, but in this case oracle is
not inconsistent.
В списке pgsql-bugs по дате отправления: