Обсуждение: Inheritance question

Поиск
Список
Период
Сортировка

Inheritance question

От
Adam Witney
Дата:
Firstly, is there a problem with the mailing list archives? Searching seems
to just hang at the moment...

I have a table that inherits an id field from a parent table, is there a way
of determining which child table the row containing a particular id value
comes from?

Also, just out of interest, if one table inherits a field from another table
does the values contained within that field get stored on disk twice? (once
for the parent table and once for the child table).

Thanks for any help

Adam


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Quick Inheritance questions

От
Adam Witney
Дата:

Hi,

Just had a few quick questions on using inheritance

I have a table that inherits an id field from a parent table, is there a way
of determining which child table the row containing a particular id value
comes from?

Also, just out of interest, if one table inherits a field from another table
does the values contained within that field get stored on disk twice? (once
for the parent table and once for the child table).

Thanks for any help

Adam



--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Re: Quick Inheritance questions

От
Tom Lane
Дата:
Adam Witney <awitney@sghms.ac.uk> writes:
> I have a table that inherits an id field from a parent table, is there a way
> of determining which child table the row containing a particular id value
> comes from?

SELECT tableoid, ...other stuff... FROM parenttable WHERE ...

Typically you'd add a join to pg_class so that you can identify the
table by name instead of OID, but that's the basic idea.

> Also, just out of interest, if one table inherits a field from another table
> does the values contained within that field get stored on disk twice? (once
> for the parent table and once for the child table).

No.

            regards, tom lane