Re: Getting NEW and OLD in ordinary functions.

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: <mallah(at)trade-india(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Getting NEW and OLD in ordinary functions.
Date: 2003-04-09 19:13:57
Message-ID: 200304091213.57184.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Rajesh,

> This was for simulating CHECK (column in ('A','B' , 'C')) ;
>
> I already have 5 FKEYS on that table dont' u feel fkeys for this
> purpose is an overkill?
> eg here the valid values can range from say 3 to 10 (small number)
> whereas FKEYS are capable to check in a very large set residing in
> another table.
> also fkeys makes updates and inserts slower (i feel)

The problem with CHECK constraints is:
1) If you forget what the range of valid values for the column is, you have to
dump the constraint definition to find out;
2) If you want to add a new valid value, you have to:
a. Freeze all data entry on the table
b. delete the constraint
c. replace the constraint
d. test that the new constraint does not bug out
e. restart database access
adding a new value to a reference list is *much* easier.

> another question i have seen CHECK traslating IN to a set of ORs
> does the same happen in pl/pgsql internally? and does it really matter
> for here for small target sets?

No idea, and probably not.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Franco Bruno Borghesi 2003-04-09 21:43:48 asymetric cryptography
Previous Message mallah 2003-04-09 19:09:13 Re: Getting NEW and OLD in ordinary functions.