pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: mallah@trade-india.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Getting NEW and OLD in ordinary functions.
Date: Wed, 9 Apr 2003 12:13:57 -0700
Message-ID: <200304091213.57184.josh@agliodbs.com> (raw)
In-Reply-To: <1461.219.65.233.94.1049915353.squirrel@mail.trade-india.com>
References: <200304091551.02277.mallah@trade-india.com>
	<200304091123.16123.josh@agliodbs.com>
	<1461.219.65.233.94.1049915353.squirrel@mail.trade-india.com>

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




view thread (7+ messages)

Message-ID: <200304091213.57184.josh@agliodbs.com>
Permalink:  ../200304091213.57184.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200304091213.57184.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, mallah@trade-india.com
  Subject: Re: Getting NEW and OLD in ordinary functions.
  In-Reply-To: <200304091213.57184.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox