X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EFC839DCC45 for ; Thu, 16 Mar 2006 15:44:56 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91754-02 for ; Thu, 16 Mar 2006 15:44:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from perseverance.encs.concordia.ca (perseverance-96.encs.concordia.ca [132.205.96.94]) by postgresql.org (Postfix) with ESMTP id EAA919DCC19 for ; Thu, 16 Mar 2006 15:44:54 -0400 (AST) Received: from [132.205.47.205] (IDENT:emilu@curacao.encs.concordia.ca [132.205.47.205]) by perseverance.encs.concordia.ca (8.12.11/8.12.11) with ESMTP id k2GJisMw027286; Thu, 16 Mar 2006 14:44:54 -0500 Message-ID: <4419C035.7000008@encs.concordia.ca> Date: Thu, 16 Mar 2006 14:44:53 -0500 From: Emi Lu Reply-To: emilu@encs.concordia.ca User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Richard Huxton CC: pgsql-sql@postgresql.org Subject: Re: About how to use "exception when ??? then " References: <4419AB1A.3070805@encs.concordia.ca> <4419B616.2040105@archonet.com> In-Reply-To: <4419B616.2040105@archonet.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.43 on perseverance.encs.concordia.ca at 2006/03/16 14:44:54 EST X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.137 required=5 tests=[AWL=0.137] X-Spam-Score: 0.137 X-Spam-Level: X-Archive-Number: 200603/241 X-Sequence-Number: 24587 > From the page: > "The PL/pgSQL condition name for each error code is the same as the > phrase shown in the table, with underscores substituted for spaces. > For example, code 22012, DIVISION BY ZERO, has condition name > DIVISION_BY_ZERO. Condition names can be written in either upper or > lower case. > (Note that PL/pgSQL does not recognize warning, as opposed to error, > condition names; those are classes 00, 01, and 02.)" That means pl/pgsql will not recognize error codes under classes 00, 01, 02. Is there a way, I can output error code? exception when ... then when others then raise notice '%, %', SQLSTATE, SQLERRM; But it seems that SQLERRM and SQLSTATE did not work for me. By the way, I am using postgresql 8.0.1. Thanks a lot, Ying >