From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Daniel Verite" <daniel(at)manitou-mail(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Suggested fix for \p and \r in psql |
Date: | 2017-04-02 15:41:04 |
Message-ID: | 27209.1491147664@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> "Daniel Verite" <daniel(at)manitou-mail(dot)org> writes:
>> 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 a bit more thought, it seems like the definition we want for
these is "print what \g would execute, but don't actually change
the buffer state". So \w is doing the right thing, \p is not, and
that half of your patch is correct. (I'd be inclined to document
that spec in a comment in each place, though.)
>> 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.
Still not sure about this. The actual behavior of \r under the old
code was to clear query_buf if it was nonempty and otherwise clear
previous_buf. It's hard for me to credit that that was intentional,
but maybe it was, or at least had behavior natural enough that nobody
complained about it. Your patch does strictly more than that, and
I think it's too much. What I committed does strictly less; is it
too little?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2017-04-02 15:44:45 | Re: Suggested fix for \p and \r in psql |
Previous Message | Tom Lane | 2017-04-02 15:18:09 | Re: Suggested fix for \p and \r in psql |