Suggested fix for \p and \r in psql
Daniel Verite <daniel@manitou-mail.org>
From: "Daniel Verite" <daniel@manitou-mail.org>
To: pgsql-hackers@postgresql.org
Date: 2017-04-02T13:22:04Z
Lists: pgsql-hackers
Attachments
- psql-query-buffer.diff (text/x-patch) patch
Hi, I've noticed two issues with the query buffer post-commit e984ef5 (Support \if ... \elif ... \else ... \endif in psql scripting): 1. \p ignores the "previous buffer". Example: postgres=# select 1; ?column? ---------- 1 (1 row) postgres=# \p Query buffer is empty. That doesn't match the pre-commit behavior, and is not consistent with \e or \w 2. \r keeps the "previous buffer". I think it should clear it. Example: postgres=# select 1; ?column? ---------- 1 (1 row) postgres=# select 2 \r Query buffer reset (cleared). postgres=# \w /tmp/buffer postgres=# \! cat /tmp/buffer select 1; I suggest the attached fix, with a few new regression tests. Best regards, -- Daniel Vérité PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite
Commits
-
Doc: clarify behavior of OT_WHOLE_LINE and OT_FILEPIPE psql slash commands.
- ffac5998b4c1 10.0 landed
-
Document psql's behavior of recalling the previously executed query.
- 68dba97a4dea 10.0 landed
-
Fix behavior of psql's \p to agree with \g, \w, etc.
- 5dbc5da1187c 10.0 landed
-
Support \if ... \elif ... \else ... \endif in psql scripting.
- e984ef5861df 10.0 cited