Re: How can I get and handle the status of sql statements that run in plpgsql ?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: David Gauthier <davegauthierpg(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How can I get and handle the status of sql statements that run in plpgsql ?
Date: 2018-10-02 21:27:52
Message-ID: c3cd9d3a-6349-d1f1-3706-94518a10d0a8@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/2/18 1:47 PM, David Gauthier wrote:
> Hi:
> psql (9.6.7, server 9.5.2) on linux
>
> How does one get the status of an sql statement executed in plpgsql?  If
> that status is cryptic, how can that be translated to something which
> someone could understand?   Finally, how can I effectively do a start
> transaction and either rollback or commit based on the results of the
> sql statements run?
>

>
> Of course I don't know what the <capture the status> and
> "something_went_wrong" pieces look like, or they even make sense with
> how this sort of thing shold be properly handled in plpgsql.  Also, in

The below(read to bottom of the page) might help:

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

> my trials, it appears that plpgsql doesn't like "start transaction".  So
> how is that piece done ?
>
> Thanks in Advance for any help !
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-10-02 21:41:16 Re: metadata about creation and size of tables
Previous Message Christopher Browne 2018-10-02 21:18:42 Re: How can I get and handle the status of sql statements that run in plpgsql ?