From: | Vadim Mikheev <vadim(at)krs(dot)ru> |
---|---|
To: | Lorenzo Huerta <lorhuerta(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] Fwd: help with uniq index (fwd) |
Date: | 1998-07-23 19:41:23 |
Message-ID: | 35B791E3.AF429A52@krs.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Lorenzo Huerta wrote:
>
> can you all help me with this:
>
> > is there a way to create a unique index on a field
> > (in ver 6.3.1) and also
> > have a single non-uniq value in that value, ie the NULL value?
Why do you ask? Why don't you try first?
vac=> create table t (x int);
CREATE
vac=> create unique index ti on t (x);
CREATE
vac=> insert into t values (1);
INSERT 18444 1
vac=> insert into t values (1);
ERROR: Cannot insert a duplicate key into a unique index
vac=> insert into t values (null);
INSERT 18446 1
vac=> insert into t values (null);
INSERT 18447 1
vac=> insert into t values (null);
INSERT 18448 1
Vadim
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Lynch | 1998-07-23 21:22:09 | Re: [GENERAL] importing into postgres |
Previous Message | Lorenzo Huerta | 1998-07-23 18:55:43 | Fwd: help with uniq index (fwd) |
From | Date | Subject | |
---|---|---|---|
Next Message | mrpark | 1998-07-24 01:56:02 | How Can I limit the select result ? |
Previous Message | Lorenzo Huerta | 1998-07-23 18:55:43 | Fwd: help with uniq index (fwd) |