Re: unique ID across all columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Felix Kater <fkater(at)googlemail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: unique ID across all columns
Date: 2007-04-17 15:12:56
Message-ID: 22258.1176822776@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Felix Kater wrote:
>> I need a unique ID across all columns I create. Is it o.k. to
>> achive this by combining pg_attribute.attnum of a column together with
>> the OID of the table the column is in?

> Yes, the table OID is unique, and pg_attribute.attnum is unique as well.
> They are not reused, not even when columns are dropped.

The OID could be re-used after the table is dropped, though. It's not
clear whether Felix needs uniqueness across time or just at any one
instant.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ketema 2007-04-17 15:19:19 Re: Dynamic DDL
Previous Message Mageshwaran 2007-04-17 14:27:12 Incremental backups