Re: PostgreSQL equivalent of the Oracale 'unique' qualifier

From: Alexander Staubo <alex(at)purefiction(dot)net>
To: stafford(at)marine(dot)rutgers(dot)edu
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
Date: 2006-11-20 21:43:50
Message-ID: 4D1E93C0-17B0-4A29-B463-3917CE380B9A@purefiction.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Nov 20, 2006, at 21:13 , Wm.A.Stafford wrote:

> I hope the subject says it all. I'm porting an Oracle-centric
> application to PostgreSQL and the Oracle sql is full of the
> 'unique' qualifier. I'm assuming PostgreSQL does not support
> 'unique' since don't see a 'unique' anywhere in the PostgreSQL
> docs. Is there a substitute or a technique to get the same result?

Which documentation? It's in the index:

http://www.postgresql.org/docs/8.1/interactive/bookindex.html

The entry points here:

http://www.postgresql.org/docs/8.1/interactive/ddl-
constraints.html#AEN2016

PostgreSQL does ANSI SQL:

create table foo (s text unique);

create table foo (s text, constraint s_unique unique (s));

alter table foo add constraint s_unique unique (s);

And the usual index syntax:

create unique index foo_s_index on foo (s);

Syntax reference:

http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html
http://www.postgresql.org/docs/8.1/interactive/sql-altertable.html
http://www.postgresql.org/docs/8.1/interactive/sql-createindex.html

Alexander.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2006-11-20 22:01:47 Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
Previous Message Bruce Momjian 2006-11-20 21:28:17 Re: pg_get_serial_sequence is inconsistent