andyatkinson / pg_scripts

PostgreSQL queries and scripts
https://andyatkinson.com/postgresql-tips
81 stars 9 forks source link

Does `administration/tail_log.sh` not work with paths containing spaces? #4

Open nigel-lowry opened 2 months ago

nigel-lowry commented 2 months ago

I installed Postgres on macOS with the Postgres.app as described in "High Performance PostgreSQL for Rails". This means it's installed at .../Library/Application Support/Postgres/var-16 (which contains a space). The administration/tail_log.sh script isn't working; could that be the cause?

andyatkinson commented 2 weeks ago

Hi @nigel-lowry Thanks! I've found I need to either backslack escape the space, or surround the whole path in double quotes.

This script runs for me like:

sh tail_log.sh

SHOW data_directory: /Users/andy/Library/Application Support/Postgres/var-16
SELECT pg_current_logfile(): log/postgresql-2024-08-28_113704.log

I've found either of these works to edit the conf file:

vim "/Users/andy/Library/Application Support/Postgres/var-16/postgresql.conf"

vim /Users/andy/Library/Application\ Support/Postgres/var-16/postgresql.conf

Hope that helps!