Skip site navigation (1) Skip section navigation (2)

Re: Unique indices and nulls

From: Roland Roberts <roland(at)astrofoto(dot)org>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Unique indices and nulls
Date: 2002-09-11 14:29:18
Message-ID: m265xc38ht.fsf@kuiper.rlent.pnet (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

    Tom> Tell you the truth, my advice is to reconsider the way you're
    Tom> using NULLs.  C.J. Date thinks NULLs are evil and best
    Tom> avoided ... your case may be an example of what he's driving
    Tom> at.

I have reconsidered...the NULLs have to stay, but the index is no
longer unique, it is only on the non-null columns, and is only being
used for select purposes.  Instead, I am enforcing the constraint via
a "before insert" trigger.  Except for loading the table, this table
will have virtually no inserts, so the trigger seems a reasonable way
to go.

		       PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD                             RL Enterprises
roland(at)rlenter(dot)com                     76-15 113th Street, Apt 3B
roland(at)astrofoto(dot)org                       Forest Hills, NY 11375

In response to

pgsql-novice by date

Next:From: David LloydDate: 2002-09-11 14:34:53
Subject: Re: real beginner's questions
Previous:From: Oliver ElphickDate: 2002-09-11 14:19:27
Subject: Re: Strange situation with two tables.

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group