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.