Re: PRIMARY KEYS

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: javier garcia - CEBAS <rn001(at)cebas(dot)csic(dot)es>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PRIMARY KEYS
Date: 2003-05-20 10:55:11
Message-ID: 20030520105511.GA4069@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 20, 2003 at 11:04:02AM +0200, javier garcia - CEBAS wrote:
> Hi;
> I'm pretty new in Postgres.
> I've created several tables but I didn't care about PRIMARY KEYS in the
> begining. Now I woul like to add them to the tables.
> I've read that PostgreSQL adds an automatic column called OID to each table;
> but when I do a SELECT, the OID column doesn't not appear.

The OID is hidden from view. You have to ask from it explicitly.

> Is this OID column a PRIMARY KEY by default? Can I see it?

No, the oid field is not guarenteed to be unique.

> How can I see what column is the primary key in a table?

\d table mentions it iirc

> Can I select, at any moment a different Prymary Key?

A primary is just a unique identifier. So any field with a unique index can
be a primary key.

> Can I alter the values of a Prymary Key in a Table?

Yes.

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
> - Samuel P. Huntington

In response to

  • PRIMARY KEYS at 2003-05-20 09:04:02 from javier garcia - CEBAS

Browse pgsql-general by date

  From Date Subject
Next Message Kaare Rasmussen 2003-05-20 10:56:40 Re: How to get required space between field names
Previous Message alex b. 2003-05-20 10:51:00 Re: How to get required space between field names