Обсуждение: Typo in psql doc

Поиск
Список
Период
Сортировка

Typo in psql doc

От
PG Doc comments form
Дата:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/app-psql.html
Description:

There is a spurious space inside the documentation:
\set HISTFILE ~/.psql_history- :DBNAME
instead of
\set HISTFILE ~/.psql_history-:DBNAME

Re: Typo in psql doc

От
Michael Paquier
Дата:
On Tue, Apr 13, 2021 at 07:57:54AM +0000, PG Doc comments form wrote:
> There is a spurious space inside the documentation:
> \set HISTFILE ~/.psql_history- :DBNAME
> instead of
> \set HISTFILE ~/.psql_history-:DBNAME

Both commands sey in your .psqlrc results in the same path being
used, as I guess that psqlscanslash.l eats all the whitespaces
in-between.  So the documentation is not wrong here (see also commit
e4c7619).
--
Michael

Вложения

Re: Typo in psql doc

От
Tom Lane
Дата:
Michael Paquier <michael@paquier.xyz> writes:
> On Tue, Apr 13, 2021 at 07:57:54AM +0000, PG Doc comments form wrote:
>> There is a spurious space inside the documentation:
>> \set HISTFILE ~/.psql_history- :DBNAME
>> instead of
>> \set HISTFILE ~/.psql_history-:DBNAME

> Both commands sey in your .psqlrc results in the same path being
> used, as I guess that psqlscanslash.l eats all the whitespaces
> in-between.  So the documentation is not wrong here (see also commit
> e4c7619).

I think that e4c7619 may have been working around a since-fixed
limitation in variable expansion.  [experiments ...]  Ah, looks like
this behavior changed in 9.2, which is later than I would've guessed:

psql (9.1.24)
Type "help" for help.

regression=# \set FOO bar-:DBNAME
regression=# \echo :FOO
bar-:DBNAME

psql (9.2.24)
Type "help" for help.

regression=# \set FOO bar-:DBNAME
regression=# \echo :FOO
bar-regression


As you say, both ways now give the same result.  Since it's not the
point of this example to illustrate \set's space-eating behavior,
it might be clearer to revert the addition of the space.

            regards, tom lane



Re: Typo in psql doc

От
Michael Paquier
Дата:
On Wed, Apr 14, 2021 at 10:12:02AM -0400, Tom Lane wrote:
> As you say, both ways now give the same result.  Since it's not the
> point of this example to illustrate \set's space-eating behavior,
> it might be clearer to revert the addition of the space.

Oh, interesting point.  I did not notice that this was different
before.
--
Michael

Вложения

Re: Typo in psql doc

От
Ludovic Kuty
Дата:
Yes indeed, thanks. I re-tested the example this morning and it worked correctly with the space. I guess I had messed up things when I first tried it.
14 April 2021 at 07:58

Both commands sey in your .psqlrc results in the same path being
used, as I guess that psqlscanslash.l eats all the whitespaces
in-between. So the documentation is not wrong here (see also commit
e4c7619).
--
Michael
13 April 2021 at 09:57
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/13/app-psql.html
Description:

There is a spurious space inside the documentation:
\set HISTFILE ~/.psql_history- :DBNAME
instead of
\set HISTFILE ~/.psql_history-:DBNAME

Re: Typo in psql doc

От
Michael Paquier
Дата:
On Thu, Apr 15, 2021 at 09:55:53AM +0200, Ludovic Kuty wrote:
> Yes indeed, thanks. I re-tested the example this morning and it worked
> correctly with the space. I guess I had messed up things when I first tried
> it.

After seeing Tom's argument that this behavior become more consistent
in 9.2, and that e4c7619 introduced it initially because of what ~9.1
was doing, I have considered both points and just applied a small
patch for HEAD with 1840d9f to remove the space.
--
Michael

Вложения