Re: [proposal] Add an option for returning SQLSTATE in psql error message

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Steele <david(at)pgmasters(dot)net>, didier <did447(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Pavel Stěhule <pavel(dot)stehule(at)gmail(dot)com>, "andrew(at)tao11(dot)riddles(dot)org(dot)uk" <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [proposal] Add an option for returning SQLSTATE in psql error message
Date: 2019-03-21 18:54:30
Message-ID: em5EhFxaurg1JEm8EdSAPFUuTdp7gj4cQMFByGDvRrmXuYZjyAYwheFQCjodb_KnBDhKpLhHm9aL85xGLvdmPlL8P2_vcTDqtXTu_x0CaJY=@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thursday, March 21, 2019 7:47 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> David Steele david(at)pgmasters(dot)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.

In GPDB we have to handle variable output in tests similar to this (but
for very different reasons), and unless there is a big gain elsewhere
from having variable test output I would advise against it. It adds a
fair bit of complexity and another moving part which can mask subtle
test failures.

cheers ./daniel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-03-21 18:56:24 Re: pg_basebackup ignores the existing data directory permissions
Previous Message Tom Lane 2019-03-21 18:47:43 Re: [proposal] Add an option for returning SQLSTATE in psql error message