Thread: Re: Suggested fix for \p and \r in psql

Re: Suggested fix for \p and \r in psql

From
Tom Lane
Date:
"Daniel Verite" <daniel@manitou-mail.org> writes:
> The documentation over-simplifies things as if there
> was only one query buffer, instead of two of them.

Yeah, there's a lot of oversimplification in the docs for slash commands
--- for instance, I was just noticing yesterday that there's no mention
of the variant argument-parsing behavior of slash commands that use
OT_WHOLE_LINE or OT_FILEPIPE parsing.  It would be good to make some
effort to improve that.  It seems like a separate question from what
the code should do, though.

My first thought about how to document the query-buffer behavior is
to continue to speak as though there is only one query buffer, but
to add, for example, for the \g command "If the query buffer is empty
then the most recent command is re-executed".

If we do phrase it like that, I think that the most natural behavior
for \r is the way I have it in HEAD --- you'd expect it to clear
the query buffer, but you would not expect it to forget the most
recent command.
        regards, tom lane



Re: Suggested fix for \p and \r in psql

From
"Daniel Verite"
Date:
    Tom Lane wrote:

> If we do phrase it like that, I think that the most natural behavior
> for \r is the way I have it in HEAD --- you'd expect it to clear
> the query buffer, but you would not expect it to forget the most
> recent command.

Okay, leaving out \r as it is and changing only \p works for me.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite



Re: Suggested fix for \p and \r in psql

From
Tom Lane
Date:
"Daniel Verite" <daniel@manitou-mail.org> writes:
>     Tom Lane wrote:
>> If we do phrase it like that, I think that the most natural behavior
>> for \r is the way I have it in HEAD --- you'd expect it to clear
>> the query buffer, but you would not expect it to forget the most
>> recent command.

> Okay, leaving out \r as it is and changing only \p works for me.

Sold, I'll adjust your patch and push it.
        regards, tom lane