Re: [GENERAL] False unique constraint violation (exception block)

2013-04-15 Thread whiplash
I found error in my DB - sequence for column id had value less "SELECT max ( id ) FROM table0" (sequence throwed unique violation exception too). I set valid value for sequence and issue was resolved. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] False unique constraint violation (exception block)

2013-04-13 Thread whiplash
PostgreSQL version: PostgreSQL 9.2.2 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit OS: Ubuntu 12.10 Linux machine0 3.5.0-26-generic #42-Ubuntu SMP Fri Mar 8 23:18:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux As for my case, I use this function as fun

Re: [GENERAL] False unique constraint violation (exception block)

2013-04-12 Thread Jeff Janes
On Fri, Apr 12, 2013 at 8:44 AM, whiplash wrote: > > CREATE UNIQUE INDEX idx_table0_unique > ON table0 ( field0, coalesce ( field1, 'INDEX_COLUMN_NULL' ) ); > > I created function for insert only unique record (part of code): > > BEGIN > INSERT INTO table0 ( field0, field1 ) VALUES ( p_field0

Re: [GENERAL] False unique constraint violation (exception block)

2013-04-12 Thread Kevin Grittner
whiplash wrote: > sometimes I getting false unique violation How do you know that they are false? What version of PostgreSQL is this? Can you create a small self-contained test case that demonstrates the issue?  (The snippets you provided probably excluded the cause of the problem.) http://wi

[GENERAL] False unique constraint violation (exception block)

2013-04-12 Thread whiplash
Hello. This is simple example for describe my problem. I created a table: CREATE TABLE table0 ( id serial NOT NULL, field0 integer, field1 text ); I created an unique index for this table: CREATE UNIQUE INDEX idx_table0_unique ON table0 ( field0, coalesce ( field1, 'INDEX_COLUMN_N