summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2017-10-06 15:35:49 +0000
committerTom Lane2017-10-06 15:35:55 +0000
commit3620569fecc6c2edb1cccfbba39b86c4e7d2faae (patch)
tree6f2e746f770b658cdb5d41fb4b8cabc700c02d77
parenta5736bf754c82d8b86674e199e232096c679201d (diff)
#ifdef out some dead code in psql/mainloop.c.
This pg_send_history() call is unreachable, since the block it's in is currently only entered in !cur_cmd_interactive mode. But rather than just delete it, make it #ifdef NOT_USED, in hopes that we'll remember to enable it if we ever change that decision. Per report from David Binderman. Since this is basically cosmetic, I see no great need to back-patch. Discussion: https://postgr.es/m/HE1PR0802MB233122B61F00A15E035C83BE9C710@HE1PR0802MB2331.eurprd08.prod.outlook.com
-rw-r--r--src/bin/psql/mainloop.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c
index 0162ee8d2f..62cf1f404a 100644
--- a/src/bin/psql/mainloop.c
+++ b/src/bin/psql/mainloop.c
@@ -456,14 +456,19 @@ MainLoop(FILE *source)
} /* while !endoffile/session */
/*
- * Process query at the end of file without a semicolon
+ * If we have a non-semicolon-terminated query at the end of file, we
+ * process it unless the input source is interactive --- in that case it
+ * seems better to go ahead and quit. Also skip if this is an error exit.
*/
if (query_buf->len > 0 && !pset.cur_cmd_interactive &&
successResult == EXIT_SUCCESS)
{
/* save query in history */
+ /* currently unneeded since we don't use this block if interactive */
+#ifdef NOT_USED
if (pset.cur_cmd_interactive)
pg_send_history(history_buf);
+#endif
/* execute query unless we're in an inactive \if branch */
if (conditional_active(cond_stack))