On 09.02.2013 22:25, matti(dot)aarnio(at)methics(dot)fi wrote:
> CREATE TABLE example (
> a TIMESTAMP NOT NULL,
> b VARCHAR(256) NOT NULL,
> c VARCHAR(256) NOT NULL,
> PRIMARY KEY(a,b,c)
> );
>
> Inserting a duplicate record on this is returning an SQL Error, but the
> status code is 0 instead of expected 23505.
>
> This used to work fine in 8.x series, but is now causing trouble in 9.1.7,
> and 9.2.3.
Works for me:
postgres=# do $$
begin
insert into example values ('2001-01-01', 'foo', 'bar');
insert into example values ('2001-01-01', 'foo', 'bar');
exception
when others then raise notice 'caught %', sqlstate;
end;
$$;
NOTICE: caught 23505
DO
How exactly are you seeing the wrong status code? What client are you using?
- Heikki