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:28 -0500 |
commit | 692ca693b90667fbbf25b8e8fc99c120543df114 (patch) | |
tree | 447fd169c01b81a351c2ddfa89c6f0fbfd263a5e /src | |
parent | e7c8efa064c8294369839798ab6b23104147f667 (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.
Diffstat (limited to 'src')
-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 6a12dc9ff51..702d8aab8de 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 |