Re: inheritance

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Jake Stride <nsuk(at)users(dot)sourceforge(dot)net>
Cc: Ben Clewett <B(dot)Clewett(at)roadrunner(dot)uk(dot)com>, PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: inheritance
Date: 2003-07-09 19:01:30
Message-ID: 3F0C668A.7020803@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Avi Schwartz 2003-07-09 19:03:04 Re: inheritance
Previous Message Jake Stride 2003-07-09 17:10:47 Re: inheritance