The following bug has been logged on the website:

Bug reference:      6669
Logged by:          jose soares
Email address:      jose.soa...@sferacarta.com
PostgreSQL version: 8.4.8
Operating system:   x86_64-pc-linux-gnu, debian
Description:        

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=# 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.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to