Re: Reg. GET STACKED DIAGNOSTICS values to be stored in a single variable

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Maheswaran R <rmaheswaranmca(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Reg. GET STACKED DIAGNOSTICS values to be stored in a single variable
Date: 2022-04-07 10:44:56
Message-ID: CAFj8pRCDHAnFXV_jXsAvPpU+sDuHjP50VikwDGtnKtFiNy608w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

čt 7. 4. 2022 v 11:58 odesílatel Maheswaran R <rmaheswaranmca(at)gmail(dot)com>
napsal:

> Sir/madam,
> While exception handling, we have to write multiple repeated lines in each
> function to handle the GET STACKED DIAGNOSTICS values. it would be better
> if all items in the diagnostics may be assigned to a single
> variable/object.
> at least like
> GET STACKED DIAGNOSTICS v_state := RETURNED_SQLSTATE || MESSAGE_TEXT ||
> PG_EXCEPTION_DETAIL || PG_EXCEPTION_HINT || PG_EXCEPTION_CONTEXT;
>
> Now we have to declare more than 5 variables to store the GET STACKED
> DIAGNOSTICS values and pass it to another function to record the error log.
> if it is in a single variable/object then it will reduce the code.
>

It can be a good idea, but surely with different syntax. Maybe this
statement can be enhanced to use record variable as target, and then the
usual syntax for composite value is

GET STACKED DIAGNOSTICS r := RETURNED_SQLSTATE, MESSAGE_TEXT,
PG_EXCEPTION_DETAIL, ...

I am not sure if this mailing list is good for proposing some new features
- https://wiki.postgresql.org/wiki/Developer_FAQ

Regards

Pavel

--
> Ragards
> Maheswaran R
> Krishnagiri
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2022-04-07 13:16:17 How to get updated order data
Previous Message Amit Kapila 2022-04-07 10:19:10 Re: Support logical replication of DDLs