Re: Unique indices and nulls - Mailing list pgsql-novice

From Roland Roberts
Subject Re: Unique indices and nulls
Date
Msg-id m265xc38ht.fsf@kuiper.rlent.pnet
Whole thread Raw
In response to Re: Unique indices and nulls  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.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.

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

pgsql-novice by date:

Previous
From: David Lloyd
Date:
Subject: Re: real beginner's questions
Next
From: "Chad Thompson"
Date:
Subject: Re: real beginner's questions