pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: pginfo <pginfo@t1.unisoftbg.com>
Cc: Richard_D_Levine@raytheon.com, Michael Glaesemann <grzm@myrealbox.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-sql-owner@postgresql.org
Subject: Re: pg primary key bug?
Date: Thu, 17 Feb 2005 09:40:13 -0700
Message-ID: <20050217164013.GA26345@winnie.fuhr.org> (raw)
In-Reply-To: <4214B466.20908@t1.unisoftbg.com>
References: <OFEF67063C.F61988F3-ON05256F9D.005A91D6@ftw.us.ray.com>
	<4214B466.20908@t1.unisoftbg.com>

On Thu, Feb 17, 2005 at 04:12:38PM +0100, pginfo wrote:

> 01=# select * from a_constants_str where constname='DOCPLAID' ;
> constname | fid | constvalue
> -----------+-----+------------
> DOCPLAID  |   0 | SOF_19738
> DOCPLAID  |   0 | SOF_19738
> (2 rows)

Do you have any inherited tables?  What's the result of the following
query?

SELECT tableoid::regclass, *
FROM a_constants_str
WHERE constname = 'DOCPLAID';

Inherited tables are documented to have deficiencies regarding
constraints.  Observe:

CREATE TABLE parent (
    constname   varchar(30) NOT NULL,
    fid         integer NOT NULL,
    constvalue  varchar(30),
    PRIMARY KEY (constname, fid)
);  
 
CREATE TABLE child () INHERITS (parent);

INSERT INTO parent VALUES ('DOCPLAID', 0, 'SOF_19738');

INSERT INTO parent VALUES ('DOCPLAID', 0, 'SOF_19738');
ERROR:  duplicate key violates unique constraint "parent_pkey"

INSERT INTO child VALUES ('DOCPLAID', 0, 'SOF_19738');

SELECT tableoid::regclass, * FROM parent;
 tableoid | constname | fid | constvalue 
----------+-----------+-----+------------
 parent   | DOCPLAID  |   0 | SOF_19738
 child    | DOCPLAID  |   0 | SOF_19738
(2 rows)

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



view thread (27+ messages)  latest in thread

Message-ID: <20050217164013.GA26345@winnie.fuhr.org>
Permalink:  ../20050217164013.GA26345@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20050217164013.GA26345@winnie.fuhr.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, pginfo@t1.unisoftbg.com, grzm@myrealbox.com, pgsql-sql-owner@postgresql.org
  Subject: Re: pg primary key bug?
  In-Reply-To: <20050217164013.GA26345@winnie.fuhr.org>

* 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