From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | emilu(at)encs(dot)concordia(dot)ca |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: About how to use "exception when ??? then " |
Date: | 2006-03-17 08:11:50 |
Message-ID: | 441A6F46.5080609@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Emi Lu wrote:
>
>> <snip> 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.
Correct - they are informational rather than errors. I'm not sure what
it would mean to trap "successful completion" for example.
> 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.
http://www.postgresql.org/docs/8.1/static/release-8-1.html
See section E.4.3.9 - they were defined in 8.1
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | rcolmegna@tiscali.it | 2006-03-17 08:56:54 | R: Re: R: R: Re: schema inspection |
Previous Message | pgsql | 2006-03-16 21:45:03 | Re: group by function, make SQL cleaner? |