Re: unique ID across all columns - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: unique ID across all columns
Date
Msg-id 20070417141739.GB7436@alvh.no-ip.org
Whole thread Raw
In response to unique ID across all columns  (Felix Kater <fkater@googlemail.com>)
Responses Re: unique ID across all columns  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Felix Kater wrote:
> Hi,
>
> 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?
>
> While the table's OID should be unique according to the manual, I have
> found no hints about the uniqueness of attnum -- I removed and added
> some columns and it seems that already used values are not used again.

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

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: Felix Kater
Date:
Subject: unique ID across all columns
Next
From: Mageshwaran
Date:
Subject: Incremental backups