Thread: inherited tables

inherited tables

From
"Verena Ruff"
Date:
Hello,

I have some inherited tables, which all share the same primary key, like

table1 with PK id
table2 inherits table1 with PK id
table3 inherits table1 with PK id

where id is a serial.

If I have an id,  is there an easy way to find out in which of these
tables this record is created (was it INSERT INTO table1 or INSERT INTO
table2 or INSERT INTO table3)?
Hope you understood what I intented to say.

Regards,
Verena


Re: inherited tables

From
Sean Davis
Date:


On 7/9/06 9:40 AM, "Verena Ruff" <lists@triosolutions.at> wrote:

>
> Hello,
>
> I have some inherited tables, which all share the same primary key, like
>
> table1 with PK id
> table2 inherits table1 with PK id
> table3 inherits table1 with PK id
>
> where id is a serial.
>
> If I have an id,  is there an easy way to find out in which of these
> tables this record is created (was it INSERT INTO table1 or INSERT INTO
> table2 or INSERT INTO table3)?

There is an example in the docs:

http://www.postgresql.org/docs/8.1/interactive/ddl-inherit.html

Sean