Fix multiple bugs in PostgreSQL hook #677

Merged
witten merged 6 commits from jirutka/borgmatic:fix-postgres-hook into main 2023-04-21 04:05:22 +00:00
1 changed files with 2 additions and 1 deletions
Showing only changes of commit 874fba7672 - Show all commits

View File

@ -59,8 +59,9 @@ def database_names_to_dump(database, extra_environment, log_prefix, dry_run):
if dry_run:
return ()
psql_command = database.get('psql_command') or 'psql'
list_command = (
jirutka marked this conversation as resolved
Review

Nice.. I didn't know about shlex.split()!

Nice.. I didn't know about `shlex.split()`!
('psql', '--list', '--no-password', '--csv', '--tuples-only')
(psql_command, '--list', '--no-password', '--csv', '--tuples-only')
+ (('--host', database['hostname']) if 'hostname' in database else ())
+ (('--port', str(database['port'])) if 'port' in database else ())
Review

The addition of --no-psqlrc sounds more correct, but I do worry a little that someone will be relying on their ~/.psqlrc to be read. I guess we'll find out.

The addition of `--no-psqlrc` sounds more correct, but I do worry a little that someone will be relying on their `~/.psqlrc` to be read. I guess we'll find out.
Review

This is not a hypothetical situation, it happened to me… borgmatic failed because I have \pset linestyle unicode and \pset border 2 in .psqlrc.

This is not a hypothetical situation, it happened to me… borgmatic failed because I have `\pset linestyle unicode` and `\pset border 2` in `.psqlrc`.
+ (('--username', database['username']) if 'username' in database else ())