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
databaseaccess
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 BerkusAglio Database SolutionsSan Francisco