From: Scott Marlowe <smarlowe@g2switchworks.com>
To: PFC <lists@boutiquenumerique.com>
Cc: orange_crush_068@hotmail.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Unique primary index?
Date: Tue, 28 Jun 2005 12:47:22 -0500
Message-ID: <1119980842.8208.111.camel@state.g2switchworks.com> (raw)
In-Reply-To: <op.ss3av5both1vuj@localhost>
References: <1119530632.181638.4330@g49g2000cwa.googlegroups.com>
<op.ss3av5both1vuj@localhost>
On Tue, 2005-06-28 at 12:01, PFC wrote:
> >
> > What are the major differences between Unique, primary index & just
> > plain index?
> >
> > When creating tables I nominate one of these, but not sure what the
> > difference is?
> index is... an index !
>
> UNIQUE is an index which won't allow duplicate values (except for NULLS)
>
> PRIMARY KEY is exactly like UNIQUE NOT NULL, with the bonus that the
> database knows this column is the primary key so you can use stuff like
> NATURAL JOIN without telling which column you want to use.
No. natural join joins on columns with the same name. However,
primary keys ARE automatically referred to by fk'd columns.
Personally, I think that a natural join should use the primary/fk
relationship as well, but I guess that's not what the spec says.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: smarlowe@g2switchworks.com, lists@boutiquenumerique.com, orange_crush_068@hotmail.com
Subject: Re: Unique primary index?
In-Reply-To: <1119980842.8208.111.camel@state.g2switchworks.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox