Re: Suggested fix for \p and \r in psql
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Verite <daniel@manitou-mail.org>,
PostgreSQL Developers <pgsql-hackers@postgresql.org>
Date: 2017-04-02T15:44:45Z
Lists: pgsql-hackers
>> 1. \p ignores the "previous buffer". Example: > > Yeah, I did that intentionally, thinking that the old behavior was > confusing. We can certainly discuss it though. I'd tend to agree > with your point that \p and \w should print the same thing, but > maybe neither of them should look at the previous_buf. After some testing: ISTM that \p should print what \g would execute, otherwise there is no consistent way to look at what \g would do. Currently \e allows to look at this (previous) executed buffer by editing it, but I would find it more consistent if \p is in sync with that, and \e also coldly executes the command on return if it ends with ";". >> 2. \r keeps the "previous buffer". I think it should clear it. > > I don't really agree with this. The fact that it used to clear both > buffers was an implementation accident that probably nobody had even > understood clearly. ISTM that loses functionality because you can't > do \g anymore. I agree on this one. -- Fabien.
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