git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 04da323)
Don't elide blank lines when accumulating psql command history.
2011年11月16日 01:34:47 +0000 (20:34 -0500)
2011年11月16日 01:34:47 +0000 (20:34 -0500)
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.


diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index 6628c0c30cb6974534eca3d63c241543e946f201..ec0e6e1d49bc253193b934046cc6d6dc9ff1b2fe 100644 (file)
--- 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
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /