agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: pgsql-sql@lists.postgresql.org
Subject: Re: Try catch error, return data
Date: Wed, 16 Feb 2022 11:01:37 +0100
Message-ID: <YgzLgdYh2J0bnbCX@hermes.hilbert.loc> (raw)
In-Reply-To: <CA+i5Jwbf0OUut+aMSAi4o+CuPc3aV6rQpnCD6xYjSZX5CAM3Cg@mail.gmail.com>
References: <CA+i5Jwbf0OUut+aMSAi4o+CuPc3aV6rQpnCD6xYjSZX5CAM3Cg@mail.gmail.com>

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





view thread (3+ messages)

Message-ID: <YgzLgdYh2J0bnbCX@hermes.hilbert.loc>
Permalink:  ../YgzLgdYh2J0bnbCX@hermes.hilbert.loc/
Also on:    postgresql.org/message-id/YgzLgdYh2J0bnbCX@hermes.hilbert.loc

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Karsten.Hilbert@gmx.net, pgsql-sql@lists.postgresql.org
  Subject: Re: Try catch error, return data
  In-Reply-To: <YgzLgdYh2J0bnbCX@hermes.hilbert.loc>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox