Re: [proposal] Add an option for returning SQLSTATE in psql error message - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [proposal] Add an option for returning SQLSTATE in psql error message
Date
Msg-id 25270.1553194063@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: [proposal] Add an option for returning SQLSTATE in psql errormessage  (David Steele <david@pgmasters.net>)
Responses Re: [proposal] Add an option for returning SQLSTATE in psql error message
List pgsql-hackers
David Steele <david@pgmasters.net> writes:
>>>>> Why are you not including a test for \set VERBOSITY verbose?

> What do you think, Peter?  Is the extra test valuable or will it cause 
> unpredictable outputs as Tom and Michael predict?

I'm not really sure why this is open for discussion.

regression=# \set VERBOSITY verbose
regression=# select 1/0;
ERROR:  22012: division by zero
LOCATION:  int4div, int.c:824

It's not going to be tolerable to have to adjust such a test anytime
somebody adds or removes lines in whichever backend file throws the
tested-for error (never mind more-substantial refactoring such as
moving the ereport call to a different function or file).  I also
believe that the reported line number will vary across compilers
even without that: IME you might get either the starting or ending
line number of the ereport() construct.

There's also the question of whether the function name is reliably
available.  Maybe it is now that we require C99 compatibility,
but the code hasn't been taught to assume that.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Best way to keep track of a sliced TOAST
Next
From: Daniel Gustafsson
Date:
Subject: Re: [proposal] Add an option for returning SQLSTATE in psql error message