Multiple bugs in PostgreSQL hook #678

Closed
opened 2023-04-14 22:58:16 +00:00 by witten · 2 comments
Owner

What I'm trying to do and why

Use the PostgreSQL hook to backup my databases with borgmatic, so I don't have to dump them manually.

Steps to reproduce / actual behavior

Separate bugs, each with the repro and the observed behavior:

  • Dump backups when a database is configured with format "plain".
pg_restore: error: input file appears to be a text format dump. Please use psql.
  • Use shell commands with arguments within psql_command and pg_restore_command options.

These commands are executed without shell=True, so the subprocess
module treats e.g. docker exec my_pg_container psql as a single command
(resulting in Errno 2 "No such file or directory") instead of a command
with arguments.

  • psql shouldn't read ~/.psqlrc.

Some settings in user's ~/.psqlrc, e.g. linestyle unicode, may break the
CSV output. --no-psqlrc tells psql to not read this startup file.

This is not necessary for the analyze_command and restore_command (with
all_databases), but it's generally recommended when running psql from a
script.

  • PostgreSQL hook doesn't use the psql_command option for listing databse when dumping all.

Environment

Unknown. This ticket was created from commit messages in this PR: #677

#### What I'm trying to do and why Use the PostgreSQL hook to backup my databases with borgmatic, so I don't have to dump them manually. #### Steps to reproduce / actual behavior Separate bugs, each with the repro and the observed behavior: * Dump backups when a database is configured with format "plain". ```console pg_restore: error: input file appears to be a text format dump. Please use psql. ``` * Use shell commands with arguments within `psql_command` and `pg_restore_command` options. These commands are executed without `shell=True`, so the subprocess module treats e.g. `docker exec my_pg_container psql` as a single command (resulting in `Errno 2 "No such file or directory"`) instead of a command with arguments. * `psql` shouldn't read `~/.psqlrc`. Some settings in user's `~/.psqlrc`, e.g. `linestyle unicode`, may break the CSV output. `--no-psqlrc` tells `psql` to not read this startup file. This is not necessary for the analyze_command and restore_command (with all_databases), but it's generally recommended when running psql from a script. * PostgreSQL hook doesn't use the `psql_command` option for listing databse when dumping `all`. #### Environment Unknown. This ticket was created from commit messages in this PR: https://projects.torsion.org/borgmatic-collective/borgmatic/pulls/677
witten added the
bug
label 2023-04-14 22:58:16 +00:00
Author
Owner

Fixed in main by @jirutka. Will be part of the next release.

Fixed in main by @jirutka. Will be part of the next release.
Author
Owner

This was just released in borgmatic 1.7.13!

This was just released in borgmatic 1.7.13!
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#678
No description provided.