Re: inheritance - Mailing list pgsql-novice

From Dmitry Tkach
Subject Re: inheritance
Date
Msg-id 3F0C668A.7020803@openratings.com
Whole thread Raw
In response to Re: inheritance  (Jake Stride <nsuk@users.sourceforge.net>)
List pgsql-novice
>
>
>
>The way that we have overcome the problem is so:
>
>create table a (id bigserial, ...., primary key(id));
>
>create table b (id bigserial, ..., primary key(id)) inherits (a);
>
>
I doubt this really overcomes the problem (at least, not the one,
mentioned in the original post, and not the way I would call useful for
real OO inheritance).
For example:

create table a (id int primary key, name text);
create table b (id int primary key, last_name text);

insert into a values (1, 'dima');
insert into b values (1, 'dima', 'tkach');

select * from a;


 id | name
----+------
  1 | dima
  1 | dima

Now, what kind of 'primary key' is this???

Dima

>This means that you will always have a unique key in the inherited table
>as it 'replaces' the original id.
>
>Does this answer the question or am I off the mark?
>
>Jake
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>               http://archives.postgresql.org
>
>



pgsql-novice by date:

Previous
From: Pablo Dejuan
Date:
Subject: Re: inheritance
Next
From: Avi Schwartz
Date:
Subject: Re: inheritance