Re: inheritance

Поиск
Список
Период
Сортировка
От Dmitry Tkach
Тема Re: inheritance
Дата
Msg-id 3F0C668A.7020803@openratings.com
обсуждение исходный текст
Ответ на Re: inheritance  (Jake Stride <nsuk@users.sourceforge.net>)
Список 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 по дате отправления:

Предыдущее
От: Pablo Dejuan
Дата:
Сообщение: Re: inheritance
Следующее
От: Avi Schwartz
Дата:
Сообщение: Re: inheritance