mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-03 08:00:21 +08:00
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.
This commit is contained in:
parent
e7c8efa064
commit
692ca693b9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user