pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
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: Sun, 10 Feb 2013 18:22:39 -0500
Message-ID: <15657.1360538559@sss.pgh.pa.us> (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>

matti.aarnio@methics.fi writes:
> 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.

Works for me:

regression=# CREATE TABLE example (
regression(#    a   TIMESTAMP    NOT NULL,
regression(#    b   VARCHAR(256) NOT NULL,
regression(#    c   VARCHAR(256) NOT NULL,
regression(#    PRIMARY KEY(a,b,c) 
regression(# );
CREATE TABLE
regression=# \set VERBOSITY verbose
regression=# insert into example values('today','today','foo');
INSERT 0 1
regression=# insert into example values('today','today','foo');
ERROR:  23505: duplicate key value violates unique constraint "example_pkey"
DETAIL:  Key (a, b, c)=(2013-02-10 00:00:00, today, foo) already exists.
SCHEMA NAME:  public
TABLE NAME:  example
CONSTRAINT NAME:  example_pkey
LOCATION:  _bt_check_unique, nbtinsert.c:398

I'm guessing you have a client-side problem, but since you've said
nothing about what the client-side software is, it's hard to venture
anything more detailed.

			regards, tom lane


-- 
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: <15657.1360538559@sss.pgh.pa.us>
Permalink:  ../15657.1360538559@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15657.1360538559@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, matti.aarnio@methics.fi
  Subject: Re: BUG #7865: Unexpected error code on insert of duplicate to composite primary key
  In-Reply-To: <15657.1360538559@sss.pgh.pa.us>
  References: <E1U4GzT-0005Q0-9a@wrigleys.postgresql.org> <15657.1360538559@sss.pgh.pa.us>

* 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