Re: Try catch error, return data

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: Try catch error, return data
Date: 2022-02-16 10:01:37
Message-ID: YgzLgdYh2J0bnbCX@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Am Wed, Feb 16, 2022 at 02:13:05AM +0000 schrieb Shaozhong SHI:

> In Python, one can use try statement to catch error, error can be stored as
> data.
>
> Can plpgsql catch and return error as data or a data table?

Yes, as The Fine Manual to be Read says:

https://www.postgresql.org/docs/devel/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

https://www.postgresql.org/docs/devel/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE

Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Karsten Hilbert 2022-02-16 10:03:36 Re: Is there a way to automatically scan a table and determine the format of data
Previous Message Skylar Thompson 2022-02-16 03:08:46 Re: Try catch error, return data