Re: [SQL] partial unique constraint

2004-04-06 Thread Richard Huxton
On Tuesday 06 April 2004 17:38, Robert Treat wrote: > On Tue, 2004-04-06 at 11:17, Tom Lane wrote: > > Robert Treat <[EMAIL PROTECTED]> writes: > > > Trying to come up with the proper syntax to meet the following > > > criteria: create table foo (bar integer, baz boolean UNIQUE (bar, baz = > > > tr

Re: [SQL] partial unique constraint

2004-04-06 Thread Robert Treat
On Tue, 2004-04-06 at 11:17, Tom Lane wrote: > Robert Treat <[EMAIL PROTECTED]> writes: > > Trying to come up with the proper syntax to meet the following criteria: > > create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); > > The correct way to do it is with a separate CREATE IND

Re: [SQL] partial unique constraint

2004-04-06 Thread Rod Taylor
On Tue, 2004-04-06 at 10:29, Robert Treat wrote: > Trying to come up with the proper syntax to meet the following criteria: > > create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); Tt takes 2 steps. CREATE TABLE ... CREATE UNIQUE INDEX ... (bar) WHERE baz = true; -- Rod Taylo

Re: [SQL] partial unique constraint

2004-04-06 Thread Paul Thomas
On 06/04/2004 15:29 Robert Treat wrote: Trying to come up with the proper syntax to meet the following criteria: create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); note the above syntax is not correct, but should demonstrate what i'm trying to do; I want to add a unique constra

Re: [SQL] partial unique constraint

2004-04-06 Thread Stephan Szabo
On Tue, 6 Apr 2004, Robert Treat wrote: > Trying to come up with the proper syntax to meet the following criteria: > > create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); > > note the above syntax is not correct, but should demonstrate what i'm > trying to do; I want to add a un

Re: [SQL] partial unique constraint

2004-04-06 Thread ries
You should create a functional index here. Ries > -Oorspronkelijk bericht- > Van: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Robert Treat > Verzonden: dinsdag 6 april 2004 16:30 > Aan: [EMAIL PROTECTED] > Onderwerp: [SQL] partial unique constraint > > >

Re: [SQL] partial unique constraint

2004-04-06 Thread Achilleus Mantzios
O kyrios Robert Treat egrapse stis Apr 6, 2004 : > Trying to come up with the proper syntax to meet the following criteria: > > create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); You could simply leave your table as is. A null vale on baz (equivalent of 'false') will have no

Re: [SQL] partial unique constraint

2004-04-06 Thread Tom Lane
Robert Treat <[EMAIL PROTECTED]> writes: > Trying to come up with the proper syntax to meet the following criteria: > create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); The correct way to do it is with a separate CREATE INDEX command: create table foo (bar integer, baz boolean

[SQL] partial unique constraint

2004-04-06 Thread Robert Treat
Trying to come up with the proper syntax to meet the following criteria: create table foo (bar integer, baz boolean UNIQUE (bar, baz = true)); note the above syntax is not correct, but should demonstrate what i'm trying to do; I want to add a unique constraint such that we only allow one case of