Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2011-11-16 01:34:47 +0000
committerRobert Haas2011-11-16 01:34:47 +0000
commitff4fd4bf53c5512427f8ecea08d6ca7777efa2c5 (patch)
tree2cea18c9a71656fa1ee64bd78989ea8272a67d59 /src/bin/psql/input.c
parent04da3232907680caad3445928c97a246c626a14a (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/bin/psql/input.c')
-rw-r--r--src/bin/psql/input.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index 6628c0c30cb..ec0e6e1d49b 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -95,10 +95,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