Re: getting inherited table name

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Eric Kolve <ekolve(at)corp(dot)classmates(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: getting inherited table name
Date: 2001-09-06 13:08:17
Message-ID: Pine.LNX.4.30.0109061507340.823-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eric Kolve writes:

> When you do SELECT * FROM cities, you get both capitals and cities. Is
> there anyway to get get the name of the table so I could possibly know
> the 'type' it was? Or should this be maintained as a separate column
> 'city_type' that has a value of 'capital'?

There's an otherwise hidden column called "tableoid" that contains the oid
of the table the row really came from. You can join that against pg_class
to get the name of the table.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Wheeler 2001-09-06 13:22:22 Re: Bug in createlang?
Previous Message Andrew Gould 2001-09-06 12:51:21 Re: template0 and template1 databases