inherited, unique serial field...

Will Trillich <will@serensoft.com>

From: will trillich <will@serensoft.com>
To: pgsql-general@postgresql.org
Date: 2003-02-07T10:45:26Z
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@serensoft.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/ !