diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-11-15 20:34:47 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-11-15 20:36:24 -0500 |
commit | ae7c9262bf0e5960e85fa2284461ecaedf5b954a (patch) | |
tree | 1a987fb9827a8d5ae950196d30f02772fab7c76f | |
parent | 2463f5da3ccd67b266ee7a9b8c0906221a501b9e (diff) |
Don't elide blank lines when accumulating psql command history.
This can change the meaning of queries, if the blank line happens to
occur in the middle of a quoted literal, as per complaint from Tomas Vondra.
Back-patch to all supported branches.
-rw-r--r-- | src/bin/psql/input.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index d17c9abb95a..829f2296821 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -86,10 +86,10 @@ void pg_append_history(const char *s, PQExpBuffer history_buf) { #ifdef USE_READLINE - if (useHistory && s && s[0]) + if (useHistory && s) { appendPQExpBufferStr(history_buf, s); - if (s[strlen(s) - 1] != '\n') + if (!s[0] || s[strlen(s) - 1] != '\n') appendPQExpBufferChar(history_buf, '\n'); } #endif |