Home > Archive > PostgreSQL Discussion > March 2005 > Catch of ERROR in PLPGSQL









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Catch of ERROR in PLPGSQL
Shaun Clements

2005-03-30, 7:04 pm

Hi All

Does anyone know if Postgres supports Catching of errors, from an EXECUTE,
for Procedural Language Postgres.

Thanks in advance

Kind Regards,
Shaun Clements


Richard Huxton

2005-03-30, 7:04 pm

Shaun Clements wrote:
> Hi All
>
> Does anyone know if Postgres supports Catching of errors, from an EXECUTE,
> for Procedural Language Postgres.


In version 8, yes. See the manuals (35.7.5. Trapping Errors) for details.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)

Cristian Prieto

2005-03-30, 7:04 pm

Try a
Begin
... block to watch ...
Exception
When error_code then
... What to do ...
End;

block, it works to me, it is better explained in the manual..

----- Original Message -----
From: "Richard Huxton" <dev@archonet.com>
To: "Shaun Clements" <ShaunC@relyant.co.za>
Cc: <pgsql-general@postgresql.org>
Sent: Wednesday, March 30, 2005 11:44 AM
Subject: Re: [GENERAL] Catch of ERROR in PLPGSQL


> Shaun Clements wrote:
>
> In version 8, yes. See the manuals (35.7.5. Trapping Errors) for details.
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)
>




---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Richard Huxton

2005-03-31, 7:01 am

Shaun Clements wrote:
> Thanks for your response.
> I unfortunately have to use 7.3.
> Will try the Exception wrap. It does appear in the manual.


No it doesn't. Version 7.3 doesn't have any programmatic exception
handling. Perhaps you are reading the wrong version of the manuals?

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql
.org

Shaun Clements

2005-03-31, 7:01 am

Begin
Exception
of a basic Function.
is provided for.
What I was thinking then, it to create separate functions for the INSERT and
UPDATE
which take parameters, for the table, column, and values.
Which I can then make use of the EXCEPTION.

Kind Regards,
Shaun Clements

-----Original Message-----
From: Richard Huxton [mailto:dev@archonet
.com]
Sent: 31 March 2005 09:10 AM
To: Shaun Clements; pgsql-general@postgresql.org
Subject: Re: [GENERAL] Catch of ERROR in PLPGSQL


Shaun Clements wrote:
> Thanks for your response.
> I unfortunately have to use 7.3.
> Will try the Exception wrap. It does appear in the manual.


No it doesn't. Version 7.3 doesn't have any programmatic exception
handling. Perhaps you are reading the wrong version of the manuals?

--
Richard Huxton
Archonet Ltd

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com