Re: psql - add SHOW_ALL_RESULTS option
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Michael Paquier <michael@paquier.xyz>,
Julien Rouhaud <rjuju123@gmail.com>,
"shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>,
"pgsql-hackers@lists.postgresql.org"
<pgsql-hackers@lists.postgresql.org>
Date: 2021-04-11T16:16:04Z
Lists: pgsql-hackers
... btw, Coverity also doesn't like this fragment of the patch:
/srv/coverity/git/pgsql-git/postgresql/src/bin/psql/common.c: 1084 in ShowNoticeMessage()
1078 static void
1079 ShowNoticeMessage(t_notice_messages *notes)
1080 {
1081 PQExpBufferData *current = notes->in_flip ? ¬es->flip : ¬es->flop;
1082 if (current->data != NULL && *current->data != '\0')
1083 pg_log_info("%s", current->data);
>>> CID 1476041: Null pointer dereferences (FORWARD_NULL)
>>> Passing "current" to "resetPQExpBuffer", which dereferences null "current->data".
1084 resetPQExpBuffer(current);
1085 }
1086
1087 /*
1088 * SendQueryAndProcessResults: utility function for use by SendQuery()
1089 * and PSQLexecWatch().
Its point here is that either the test of "current->data != NULL" is
useless, or resetPQExpBuffer needs such a test too. I'm inclined
to guess the former.
(Just as a matter of style, I don't care for the flip/flop terminology
here, not least because it's not clear why exactly two buffers suffice
and will suffice forevermore. I'd be inclined to use an array of
two buffers with an index variable.)
regards, tom lane
Commits
-
psql: Show all query results by default
- 7844c9918a43 15.0 landed
- 3a5130672296 14.0 landed
-
psql: Refactor ProcessResult()
- 5519d5affdfa 15.0 landed
-
psql: Refactor SendQuery()
- 8910a25fef3d 15.0 landed
-
psql: Add test for psql behavior on server crash
- 8cd7627c7b19 15.0 landed
-
psql: Additional tests
- 9028cce426ba 15.0 landed
-
Improve some psql test code
- fbee60f6a4ff 15.0 landed
-
psql: Fix some scan-build warnings
- 390edeeb570c 15.0 landed
-
psql: Add test for handling of replication commands
- 67c069848a99 15.0 landed
-
psql: More tests
- c0280bc3edeb 15.0 landed
-
psql: Add various tests
- 14d755b00037 15.0 landed
-
psql: Add test for query canceling
- 5b3f471ff23a 15.0 landed
-
Revert "psql: Show all query results by default"
- fae65629cec8 14.0 landed
-
Extend a test case a little
- b3a9e9897ec7 14.0 landed