Re: psql - add SHOW_ALL_RESULTS option

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: psql - add SHOW_ALL_RESULTS option
Date: 2021-04-11 15:14:07
Message-ID: 2671235.1618154047@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Coverity has pointed out another problem with this patch:

/srv/coverity/git/pgsql-git/postgresql/src/bin/psql/common.c: 1425 in SendQuery()
1419 /*
1420 * Do nothing if they are messing with savepoints themselves:
1421 * If the user did COMMIT AND CHAIN, RELEASE or ROLLBACK, our
1422 * savepoint is gone. If they issued a SAVEPOINT, releasing
1423 * ours would remove theirs.
1424 */
>>> CID 1476042: Control flow issues (DEADCODE)
>>> Execution cannot reach the expression "strcmp(PQcmdStatus(results), "COMMIT") == 0" inside this statement: "if (results && (strcmp(PQcm...".
1425 if (results &&
1426 (strcmp(PQcmdStatus(results), "COMMIT") == 0 ||
1427 strcmp(PQcmdStatus(results), "SAVEPOINT") == 0 ||
1428 strcmp(PQcmdStatus(results), "RELEASE") == 0 ||
1429 strcmp(PQcmdStatus(results), "ROLLBACK") == 0))
1430 svptcmd = NULL;

It's right: this is dead code because all paths through the if-nest
starting at line 1373 now leave results = NULL. Hence, this patch
has broken the autocommit logic; it's no longer possible to tell
whether we should do anything with our savepoint.

Between this and the known breakage of control-C, it seems clear
to me that this patch was nowhere near ready for prime time.
I think shoving it in on the last day before feature freeze was
ill-advised, and it ought to be reverted. We can try again later.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-04-11 15:34:02 Re: PL/R regression on windows, but not linux with master.
Previous Message Fujii Masao 2021-04-11 15:09:05 Re: Avoid unnecessary table open/close for TRUNCATE foo, foo, foo; kind of commands