Re: Inherited table identification possible

From: George Woodring <george(dot)woodring(at)iglass(dot)net>
To: Stephen Belcher <sycobuny(at)malkier(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Inherited table identification possible
Date: 2012-05-25 13:40:36
Message-ID: CACi+J=T8YyF4PQXgGt2utaOF9FsjWp1MM2kfUASEpD=RCfcK7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks for all of the help, this was exactly what I was looking for.

George

On Thu, May 24, 2012 at 2:11 PM, Stephen Belcher <sycobuny(at)malkier(dot)net>wrote:

> Yes, the system column "tableoid" identifies the actual table in which the
> row is stored. If you cast this to "regclass" you'll get the name of the
> table that the row is stored in:
>
> SELECT tableoid::regclass FROM base_table;
>
> There's more documentation on this available at
> http://www.postgresql.org/docs/9.1/static/ddl-inherit.html (for version
> 9.1, at any rate: season to taste with your version of PG)
>
> Hope this helps,
> --Stephen
>
>
>
> On Thu, May 24, 2012 at 2:01 PM, George Woodring <
> george(dot)woodring(at)iglass(dot)net> wrote:
>
>> Is it possible to identify which inherited table data came from in a
>> query? We have a table that has 3 inherited tables attached to it. I am
>> looking for a way to identify the source of the data.
>>
>> My only thought would be to add a column to the tables that identify the
>> table. I was just checking if there was a way to do it without the column.
>>
>> Thanks,
>> George
>>
>>
>>
>> --
>> iGLASS Networks
>> www.iglass.net
>>
>
>

--
iGLASS Networks
www.iglass.net

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Raj Mathur ( राज =?utf-8?b?IOCkruCkvuCkpeClgeCksA==?=) 2012-05-26 02:56:54 Re: Flatten table using timestamp and source
Previous Message danycxxx 2012-05-25 12:57:34 Re: Select row cells as new columns