PostgreSQL equivalent of the Oracale 'unique' qualifier
PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
"Wm.A.Stafford" <stafford@marine.rutgers.edu>
Дата:
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? Thanks, -=bill stafford
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
Richard Troy <rtroy@ScienceTools.com>
Дата:
On Mon, 20 Nov 2006, 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? > > Thanks, > -=bill stafford > Would "distinct" do it for you? RT -- Richard Troy, Chief Scientist Science Tools Corporation 510-924-1363 or 202-747-1263 rtroy@ScienceTools.com, http://ScienceTools.com/
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
Adrian Klaver <aklaver@comcast.net>
Дата:
On Monday 20 November 2006 12:13 pm, 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? > > Thanks, > -=bill stafford > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster Two places I found to specify a unique constraint. http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html http://www.postgresql.org/docs/8.1/interactive/sql-createindex.htm -- Adrian Klaver aklaver@comcast.net
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
Shelby Cain <alyandon@yahoo.com>
Дата:
I'm guessing that is an Oracle-ism for the sql DISTINCT keyword. Regards, Shelby Cain ----- Original Message ---- From: Wm.A.Stafford To: pgsql-general@postgresql.org Sent: Monday, November 20, 2006 2:13:13 PM Subject: [GENERAL] PostgreSQL equivalent of the Oracale 'unique' qualifier 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? Thanks, -=bill stafford ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster ____________________________________________________________________________________ Sponsored Link Don't quit your job - take classes online www.Classesusa.com
Re: PostgreSQL equivalent of the Oracale 'unique'
От:
"Joshua D. Drake" <jd@commandprompt.com>
Дата:
On Mon, 2006-11-20 at 15:13 -0500, 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?
Distinct?
Joshua D. Drake
>
> Thanks,
> -=bill stafford
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
--
=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
Alvaro Herrera <alvherre@commandprompt.com>
Дата:
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? You gotta be kidding. Of course Postgres supports UNIQUE. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
Bricklen Anderson <banderson@presinet.com>
Дата:
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? > > Thanks, > -=bill stafford DISTINCT, and PostgreSQL's proprietary extension, DISTINCT ON. http://www.postgresql.org/docs/8.1/interactive/queries-select-lists.html#QUERIES-DISTINCT
Re: PostgreSQL equivalent of the Oracale 'unique'
От:
Scott Marlowe <smarlowe@g2switchworks.com>
Дата:
On Mon, 2006-11-20 at 14: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? Context is king. Do you mean: create unique index abc on table xyz(field1); ??? OR some other usage of unique. An example would really help us help you. otherwise we're all blind men describing an elephant (the postgresql elephant at that!) So, is it in an index, or somewhere else. Cause in an index it's fine. I've never used unique anywhere else in pgsql.
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
"Dann Corbit" <DCorbit@connx.com>
Дата:
UNIQUE index: http://www.postgresql.org/files/documentation/books/aw_pgsql/node108.htm l UNIQUE constraint: http://www.postgresql.org/files/documentation/books/aw_pgsql/node129.htm l Online manual information: http://www.postgresql.org/docs/8.2/interactive/ddl-constraints.html#AEN2 058 http://www.postgresql.org/docs/8.2/interactive/indexes-unique.html There is a little search box in the upper right hand corner that might prove helpful for your cause. > -----Original Message----- > From: pgsql-general-owner@postgresql.org [mailto:pgsql-general- > owner@postgresql.org] On Behalf Of Wm.A.Stafford > Sent: Monday, November 20, 2006 12:13 PM > To: pgsql-general@postgresql.org > Subject: [GENERAL] PostgreSQL equivalent of the Oracale 'unique' qualifier > > 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? > > Thanks, > -=bill stafford > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster
Re: PostgreSQL equivalent of the Oracale 'unique'
От:
Jeff Davis <pgsql@j-davis.com>
Дата:
On Mon, 2006-11-20 at 15:13 -0500, 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? > You mean a UNIQUE index on a column? http://www.postgresql.org/docs/8.1/static/sql-createtable.html http://www.postgresql.org/docs/8.1/static/sql-createindex.html The postgresql docs are filled with the word "UNIQUE". Regards, Jeff Davis
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Alvaro Herrera writes:
> 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?
> You gotta be kidding. Of course Postgres supports UNIQUE.
Actually, there is a in SQL92, which we've not gotten
around to implementing ... but from the subsequent discussion it seems
that what the OP is looking at is something else, ie, a gratuitously
nonstandard spelling of the DISTINCT modifier for aggregate functions :-(
A is syntactically like EXISTS:
::= UNIQUE Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
Alexander Staubo <alex@purefiction.net>
Дата:
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.
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
От:
gonzales@linuxlouis.net
Дата:
Are you talking about a SQL statement qualifier, where you may be referring to "distinct" On Mon, 20 Nov 2006, 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? > > Thanks, > -=bill stafford > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- Louis Gonzales louis.gonzales@linuxlouis.net http://www.linuxlouis.net
Re: PostgreSQL equivalent of the Oracale 'unique' qualifier
Le mardi 21 novembre 2006 00:47, Tom Lane a écrit : > Alvaro Herrera writes: > > 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? > > > > You gotta be kidding. Of course Postgres supports UNIQUE. > > Actually, there is a in SQL92, which we've not gotten > around to implementing ... but from the subsequent discussion it seems > that what the OP is looking at is something else, ie, a gratuitously > nonstandard spelling of the DISTINCT modifier for aggregate functions :-( > > A is syntactically like EXISTS: > > ::= UNIQUE