Ian Lawrence Barwick <barwick@gmail.com> writes:
> I've noticed a filename error in feedback messages from psql's '\s' command
> when saving the command line history to a file specified by an absolute
> filepath:
> psql (9.2.2)
> Type "help" for help.
> pgdevel=# \s history.txt
> Wrote history to file "./history.txt".
> pgdevel=# \s /tmp/history.txt
> Wrote history to file ".//tmp/history.txt".
> pgdevel=# \cd /tmp
> pgdevel=# \s /tmp/history.txt
> Wrote history to file "/tmp//tmp/history.txt".
> The second and third '\s' commands display incorrect filepaths in the feedback
> message, despite writing correctly to the specified file.
I wonder why we don't just revert commit 0725065b --- this complaint
shows that it was quite poorly thought out, and I don't really see the
need for it anyway. Aside from the complained-of bug, the code added to
the \cd command is entirely incapable of tracking through multiple \cd
operations properly.
If we did think that this specific backslash command needed to be able
to print something other than the filename as-entered, I'd be inclined
to just apply make_absolute_path() to the name, instead of relying on
inadequate dead-reckoning. However, that would require making
make_absolute_path available in src/port/ or someplace, which seems
a bit more than this "feature" is worth. Why should \s, and \s alone,
need to remind you where you're cd'd to?
Thoughts?
regards, tom lane