Обсуждение: Fwd: help with uniq index (fwd)

Поиск
Список
Период
Сортировка

Fwd: help with uniq index (fwd)

От
Lorenzo Huerta
Дата:


can you all help me with this:

> ---------- Forwarded message ----------
> Date: Thu, 23 Jul 1998 12:50:17 -0600 (MDT)
> From: Lorenzo Huerta <lorenzo@nmsu.edu>
> To: pgsql-sql@postgreSQL.org
> Cc: pgsql-general@postgreSQL.org
> Subject: help with uniq index
>
>
> 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?
>
>
> Thanks,
>
>
__________________________________________________________________
>      *  Lorenzo J. Huerta
 *
>      *  Programming Assistant
 *
>      *  Computing & Networking Networking Architecture and
Operations *
>      *  New Mexico State University
 *
>      *  phone: (w)(505)646-2582 (h)(505) 521-8699 fax:(505) 646-8139
 *
>      *  e-mail: lorenzo@nmsu.edu
 *
>      *  Web Site: http://web.nmsu.edu/~ljhuerta
 *
>
__________________________________________________________________
>
>
>
>

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: [GENERAL] Fwd: help with uniq index (fwd)

От
Vadim Mikheev
Дата:
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