X-Original-To: pgsql-patches-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 49CE652816 for ; Wed, 6 Jul 2005 13:10:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21896-02 for ; Wed, 6 Jul 2005 16:10:25 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 060F552838 for ; Wed, 6 Jul 2005 13:10:22 -0300 (ADT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 2BFF19B4D0; Wed, 6 Jul 2005 12:10:22 -0400 (EDT) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 41303-01-5; Wed, 6 Jul 2005 12:10:19 -0400 (EDT) Received: from [220.101.4.182] (r220-101-4-182.cpe.unwired.net.au [220.101.4.182]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id EA46B9B4B8; Wed, 6 Jul 2005 12:10:17 -0400 (EDT) Message-ID: <42CC0260.4090407@samurai.com> Date: Thu, 07 Jul 2005 02:10:08 +1000 From: Neil Conway User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: Pavel Stehule , pgsql-patches@postgresql.org Subject: Re: User's exception plpgsql References: <42CBF6AD.9080600@samurai.com> <26946.1120665361@sss.pgh.pa.us> In-Reply-To: <26946.1120665361@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/182 X-Sequence-Number: 16522 Tom Lane wrote: > I think it is a bad idea, if not actually impossible, to have an > expression for sqlstate with no separating syntax before the 'fmt'; > especially not if you'd like to also allow an expression for the 'fmt'. I don't actually see much of a need to allow 'fmt' to be an expression, especially now that RAISE parameters can be expressions. The ratio of constant printf() format strings to variable format strings is probably 100:1, for good reason... > The hard part here is that there isn't any very easy way to tell whether > you have a sqlstate, a fmt, and N exprs, or a fmt and N+1 exprs. The > saving grace of the declared-exception approach for this is that you > can tell by the datatype of the first argument expression which case you > have I really don't like the idea of introducing a new concept into the language ("exception variables") to resolve some ambiguous syntax. It would be another matter if exception variables actually provided something that strings do not... Another solution might be varying the syntax slightly, such as: RAISE [ opt_sqlstate ] LEVEL 'fmt' [ , expr ... ] -Neil