[BUG?] table inhiritance violates primary key

From: Sven Köhler <skoehler(at)upb(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: [BUG?] table inhiritance violates primary key
Date: 2003-06-25 08:57:42
Message-ID: bdbo87$nm8$1@main.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

i have two tables:
CREATE TABLE public.test1 (
id1 int4 NOT NULL,
CONSTRAINT test1_pkey PRIMARY KEY (id1)
) WITHOUT OIDS;
CREATE TABLE public.test3 (
) INHERITS(test1) WITH OIDS;

i can insert the values
1
1
1

into the table test2. when i do a select * from test1 it returns:
1
1
1

after that i can once insert the value 1 again directly into table
test1. a second try failes for table test1.

it would make more sense, if the table test2 inhirits the primary key of
table test1 because each value inserted into test2 creates an implicit
entry in table test1 (at least from the users point of view) and these
entries simply violate the primary key of test1 which is unique.

so what's the deal with table inhiritance? i guess other constraints
aren't inhirited too - what about foreign keys, unique indexes etc.?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bjorn T Johansen 2003-06-25 09:00:55 Re: Updating an emty table?
Previous Message Hubert Lubaczewski 2003-06-25 08:49:45 Re: Updating an emty table?