Re: unique ID across all columns

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Felix Kater <fkater(at)googlemail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: unique ID across all columns
Date: 2007-04-17 14:17:39
Message-ID: 20070417141739.GB7436@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mageshwaran 2007-04-17 14:27:12 Incremental backups
Previous Message Palle Girgensohn 2007-04-17 13:12:07 Re: pg_restore "out of memory" - big problem :(