From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: partial unique constraint |
Date: | 2004-04-06 19:54:07 |
Message-ID: | 200404062054.07498.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tuesday 06 April 2004 17:38, Robert Treat wrote:
> On Tue, 2004-04-06 at 11:17, Tom Lane wrote:
> > Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> 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:
>
> I think I had initially abandoned looking at that type of solution after
> having run across this paragraph in the docs while looking for the
> proper constraint syntax:
>
> "Note: The preferred way to add a unique constraint to a table is ALTER
> TABLE ... ADD CONSTRAINT. The use of indexes to enforce unique
> constraints could be considered an implementation detail that should not
> be accessed directly."
>
> The subliminal mind is a powerful force eh? Perhaps that paragraph
> should be modified... but I'm not sure if it should expanded to include
> thoughts along the lines of Stephan's response or maybe just drop the
> "should not be accessed directly" bit...
Anyone know if there is any way to do this in one of the later SQL standards?
The CREATE INDEX thing is a bit of a hack, and I certainly wouldn't have
thought of it either.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Tony Reina | 2004-04-06 20:31:43 | Help with COPY command |
Previous Message | elein | 2004-04-06 19:06:10 | Re: Function To Log Changes |