Typo in psql doc

Started by PG Bug reporting formabout 5 years ago6 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

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

#2Michael Paquier
michael@paquier.xyz
In reply to: PG Bug reporting form (#1)
Re: Typo in psql doc

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#2)
Re: Typo in psql doc

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

#4Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#3)
Re: Typo in psql doc

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

#5Ludovic Kuty
ludovic.kuty@gmail.com
In reply to: Michael Paquier (#2)
Re: Typo in psql doc

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.

Show quoted text

Michael Paquier <mailto:michael@paquier.xyz>
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
PG Doc comments form <mailto:noreply@postgresql.org>
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

#6Michael Paquier
michael@paquier.xyz
In reply to: Ludovic Kuty (#5)
Re: Typo in psql doc

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