pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: matti.aarnio@methics.fi
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key
Date: Mon, 11 Feb 2013 14:11:07 +0200
Message-ID: <5118DFDB.4080103@vmware.com> (raw)
In-Reply-To: <E1U4GzT-0005Q0-9a@wrigleys.postgresql.org>
References: <E1U4GzT-0005Q0-9a@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 09.02.2013 22:25, matti.aarnio@methics.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


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



view thread (7+ messages)  latest in thread

Message-ID: <5118DFDB.4080103@vmware.com>
Permalink:  ../5118DFDB.4080103@vmware.com/
Also on:    postgresql.org/message-id/5118DFDB.4080103@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hlinnakangas@vmware.com, matti.aarnio@methics.fi
  Subject: Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key
  In-Reply-To: <5118DFDB.4080103@vmware.com>
  References: <E1U4GzT-0005Q0-9a@wrigleys.postgresql.org> <5118DFDB.4080103@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox