Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dslr/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ def exec_sql(
global pg_client

if not pg_client:
# We always want to connect to the `postgres` and not the target
# We always want to connect to the `template1` and not the target
# database because none of our operations need to query the target
# database.
pg_client = PGClient(
host=settings.db.host,
port=settings.db.port,
user=settings.db.username,
password=settings.db.password,
dbname="postgres",
dbname="template1",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to use template0 here? That database should never be modified by users, but template1 is intended to be modified by users to provide per-cluster defaults for new databases. It seems like it might be a valid use case to use dslr to snapshot your template1 DB while experimenting with changes to it locally, whereas that should never be the case for template0.

Relevant docs: https://www.postgresql.org/docs/current/manage-ag-templatedbs.html

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @bcdickinson . I agree. I can accept this PR if we can change it to use template0.

)

return pg_client.execute(sql, data)