Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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: Tue, 17 Apr 2007 10:17:39 -0400
  • Message-id: <20070417141739(dot)GB7436(at)alvh(dot)no-ip(dot)org>

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.



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group