inherited, unique serial field... - Mailing list pgsql-general

From will trillich
Subject inherited, unique serial field...
Date
Msg-id 20030207104526.GB4841@mail.serensoft.com
Whole thread Raw
Responses Re: inherited, unique serial field...  (Shridhar Daithankar <shridhar_daithankar@persistent.co.in>)
List 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/ !

pgsql-general by date:

Previous
From: Lee Kindness
Date:
Subject: Re: PGconn thread safety
Next
From: Shridhar Daithankar
Date:
Subject: Re: inherited, unique serial field...