X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 00E70475A8D for ; Wed, 9 Apr 2003 15:14:08 -0400 (EDT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 24B7A475458 for ; Wed, 9 Apr 2003 15:14:07 -0400 (EDT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2953458; Wed, 09 Apr 2003 12:14:01 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Subject: Re: Getting NEW and OLD in ordinary functions. Date: Wed, 9 Apr 2003 12:13:57 -0700 User-Agent: KMail/1.4.3 Cc: References: <200304091551.02277.mallah@trade-india.com> <200304091123.16123.josh@agliodbs.com> <1461.219.65.233.94.1049915353.squirrel@mail.trade-india.com> In-Reply-To: <1461.219.65.233.94.1049915353.squirrel@mail.trade-india.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200304091213.57184.josh@agliodbs.com> X-Spam-Status: No, hits=-32.4 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/147 X-Sequence-Number: 12848 Rajesh, > This was for simulating CHECK (column in ('A','B' , 'C')) ; >=20 > 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=20 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. --=20 -Josh Berkus Aglio Database Solutions San Francisco