Re: Use of ?get diagnostics'? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Use of ?get diagnostics'?
Date
Msg-id af25493a-7fd3-2ee4-5416-347c8b822ef8@aklaver.com
Whole thread Raw
In response to Re: Use of ?get diagnostics'?  (Thiemo Kellner <thiemo@gelassene-pferde.biz>)
List pgsql-general
On 9/25/19 10:44 PM, Thiemo Kellner wrote:
> Hello Adrian
> 
> Quoting Adrian Klaver <adrian.klaver@aklaver.com>:
> 
>> To get above I believe you will need to use GET CURRENT DIAGNOSTICS 
>> PG_CONTEXT:
> 
> I actually use "get stacked diagnostics" to retrieve the exception 
> place. And it works. I am not sure why I did no see it.

GET [ CURRENT ] DIAGNOSTICS:
https://www.postgresql.org/docs/11/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

and

GET STACKED DIAGNOSTICS

https://www.postgresql.org/docs/11/plpgsql-control-structures.html#PLPGSQL-EXCEPTION-DIAGNOSTICS

are two different things.

See the example here:

https://www.postgresql.org/docs/11/plpgsql-control-structures.html#PLPGSQL-CALL-STACK

> 
> However, I noticed, that the stack does not include the error place in 
> dynamic SQL executed by the "execute" command. Maybe I am missing 
> something again.
> 
> Kind regards
> 
> Thiemo
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Rob Sargent
Date:
Subject: Re: managing primary key conflicts while restoring data to table with existing data
Next
From: Krishnakant Mane
Date:
Subject: Re: managing primary key conflicts while restoring data to table withexisting data