inherited, unique serial field...

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: inherited, unique serial field...
Date: 2003-02-07 10:45:26
Message-ID: 20030207104526.GB4841@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

is it bad news to have id collisions when you use an inherited
serial field?

create track (
id serial,
created date default current_date,
primary key ( id )
);

create person (
fname varchar(30),
lname varchar(30),
primary key ( id )
) inherits ( track );

create other (
val text,
) inherits ( track );

insert into other ( .... );
insert into person(id,lname)values(1,'Flintstone');
insert into person(id,lname)values(2,'Rubble');

SELECT
t.id, t.created, c.relname AS class
FROM
track t,
pg_class c
WHERE
t.id = 2
AND
(t.tableoid = c.oid);

id | created | class
----+------------+----------
4 | 2003-02-06 | other
4 | 2003-02-06 | person

even tho track.id is constrained to be unique, voila! we've got
duplicate "primary keys". is this evil enough to avoid -- or is
it innocuous?

--
There are 10 kinds of people:
ones that get binary, and ones that don't.

will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

Looking for a firewall? Do you think smoothwall sucks? You're
probably right... Try the folks at http://clarkconnect.org/ !

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2003-02-07 11:19:28 Re: inherited, unique serial field...
Previous Message Lee Kindness 2003-02-07 09:14:24 Re: PGconn thread safety