NikolayS / postgres_dba

The missing set of useful tools for Postgres DBAs and all engineers
BSD 3-Clause "New" or "Revised" License
1.03k stars 113 forks source link

Fix the section about installing #45

Closed unhandled-exception closed 3 years ago

unhandled-exception commented 4 years ago

Another slash is required when escaping for "\i"

NikolayS commented 4 years ago

@unhandled-exception what's your OS and what shell do you use? I've tested on various Linux distros (Ubuntu, Debian, CentOS) and various MacOS versions – it worked well. However, I always used bash.

What was written to .psqlrc in your case?

unhandled-exception commented 4 years ago

@unhandled-exception what's your OS and what shell do you use? I've tested on various Linux distros (Ubuntu, Debian, CentOS) and various MacOS versions – it worked well. However, I always used bash.

What was written to .psqlrc in your case?

Nikolay, I tried the original command on zsh and got an invalid result.

The result depends on the shells. On bash/sh your version works, on zsh mine, and on csh we get nonsense:

 ~ uname -a
FreeBSD v4.proc.ru 11.3-RELEASE-p7 FreeBSD 11.3-RELEASE-p7 #0: Tue Mar 17 08:32:23 UTC 2020     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
 ~ zsh
 ~ zsh --version
zsh 5.8 (amd64-portbld-freebsd11.3)
 ~ echo "\\set dba '\\\\i `pwd`/postgres_dba/start.psql'" > ./temp/test.psqlrc && cat ./temp/test.psqlrc
\set dba '\i /home/aquila/postgres_dba/start.psql'

~ bash
[user@v4 ~]$ bash --version
GNU bash, версия 5.0.11(0)-release (amd64-portbld-freebsd11.3)
Copyright (C) 2019 Free Software Foundation, Inc.
Лицензия GPLv3+: GNU GPL версии 3 или более поздней <http://gnu.org/licenses/gpl.html>

Это свободное программное обеспечение. Вы можете изменять и распространять его.
НИКАКАЯ ГАРАНТИЯ не предоставляется в пределах, допускаемых законом.
[user@v4 ~]$ echo "\\set dba '\\\\i `pwd`/postgres_dba/start.psql'" > ./temp/test.psqlrc && cat ./temp/test.psqlrc
\set dba '\\i /home/aquila/postgres_dba/start.psql'

[user@v4 ~]$ csh
Для вас есть почта.
user@v4:~ % csh --version
tcsh 6.20.00 (Astron) 2016-11-24 (x86_64-amd-FreeBSD) options wide,nls,dl,al,kan,sm,rh,color,filec
user@v4:~ % echo "\\set dba '\\\\i `pwd`/postgres_dba/start.psql'" > ./temp/test.psqlrc && cat ./temp/test.psqlrc
\\set dba '\\\\i /usr/home/aquila/postgres_dba/start.psql'

user@v4:~ % sh
$ echo "\\set dba '\\\\i `pwd`/postgres_dba/start.psql'" > ./temp/test.psqlrc && cat ./temp/test.psqlrc
\set dba '\\i /home/aquila/postgres_dba/start.psql'

It looks like the pull request can be rejected.

NikolayS commented 4 years ago

I've added a comment to README, mentioning that the .psqlrc snippet was made for Bash.

Closing this PR. Feel free to reopen if needed.

NikolayS commented 3 years ago

@unhandled-exception finally, thanks to macOS devs, I'm on zsh too – so, created https://github.com/NikolayS/postgres_dba/pull/51. Mind checking it for your setup?