From: Vadim Mikheev <vadim@krs.ru>
To: Lorenzo Huerta <lorhuerta@yahoo.com>
Cc: pgsql-general@postgreSQL.org
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [GENERAL] Fwd: help with uniq index (fwd)
Date: Fri, 24 Jul 1998 03:41:23 +0800
Message-ID: <35B791E3.AF429A52@krs.ru> (raw)
References: <19980723185543.22328.rocketmail@send1d.yahoomail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: vadim@krs.ru, lorhuerta@yahoo.com, pgsql-general@postgreSQL.org
Subject: Re: [GENERAL] Fwd: help with uniq index (fwd)
In-Reply-To: <35B791E3.AF429A52@krs.ru>
References: <19980723185543.22328.rocketmail@send1d.yahoomail.com> <35B791E3.AF429A52@krs.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox