diff --git a/site-cookbooks/kosmos_postgresql/files/create_publications.sh b/site-cookbooks/kosmos_postgresql/files/create_publications.sh index eda54ee..7b98acc 100644 --- a/site-cookbooks/kosmos_postgresql/files/create_publications.sh +++ b/site-cookbooks/kosmos_postgresql/files/create_publications.sh @@ -3,7 +3,7 @@ set -e echo "== Creating publication in each database ==" -for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1')"); do +for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1','postgres')"); do echo "Processing DB: $db" # Create publication (idempotent) diff --git a/site-cookbooks/kosmos_postgresql/files/drop_publications.sh b/site-cookbooks/kosmos_postgresql/files/drop_publications.sh index 78c8b1b..834108f 100644 --- a/site-cookbooks/kosmos_postgresql/files/drop_publications.sh +++ b/site-cookbooks/kosmos_postgresql/files/drop_publications.sh @@ -3,7 +3,7 @@ set -e echo "== Dropping subscriptions slots and publications ==" -for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1')"); do +for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1','postgres')"); do echo "Processing DB: $db" SLOT="migrate_slot_${db}" diff --git a/site-cookbooks/kosmos_postgresql/files/drop_subscriptions.sh b/site-cookbooks/kosmos_postgresql/files/drop_subscriptions.sh index a718eb5..424a022 100644 --- a/site-cookbooks/kosmos_postgresql/files/drop_subscriptions.sh +++ b/site-cookbooks/kosmos_postgresql/files/drop_subscriptions.sh @@ -3,7 +3,7 @@ set -e echo "== Dropping subscriptions ==" -for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1')"); do +for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1','postgres')"); do echo "Processing DB: $db" SUB="migrate_sub_${db}" diff --git a/site-cookbooks/kosmos_postgresql/files/dump_all_databases.sh b/site-cookbooks/kosmos_postgresql/files/dump_all_databases.sh index 7339ab5..893787a 100644 --- a/site-cookbooks/kosmos_postgresql/files/dump_all_databases.sh +++ b/site-cookbooks/kosmos_postgresql/files/dump_all_databases.sh @@ -1,7 +1,7 @@ #!/bin/bash cd /tmp && \ (pg_dumpall --globals-only > globals.sql) && \ -psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN (''template1'')" | \ +psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN (''template0'',''postgres'')" | \ xargs -I{} -P4 sh -c " pg_dump -Fd -j 4 -d \"{}\" -f dump_{} && tar -cf - dump_{} | zstd -19 -T0 > dump_{}.tar.zst && diff --git a/site-cookbooks/kosmos_postgresql/files/fix_sequences_in_all_databases.sh b/site-cookbooks/kosmos_postgresql/files/fix_sequences_in_all_databases.sh index 73b9a7d..f8fc2b2 100644 --- a/site-cookbooks/kosmos_postgresql/files/fix_sequences_in_all_databases.sh +++ b/site-cookbooks/kosmos_postgresql/files/fix_sequences_in_all_databases.sh @@ -3,7 +3,7 @@ set -e echo "== Fixing sequences across all databases ==" -for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1')"); do +for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1','postgres')"); do echo "---- DB: $db ----" # Generate fix statements diff --git a/site-cookbooks/kosmos_postgresql/files/list_publications.sh b/site-cookbooks/kosmos_postgresql/files/list_publications.sh index 7459005..13ab742 100644 --- a/site-cookbooks/kosmos_postgresql/files/list_publications.sh +++ b/site-cookbooks/kosmos_postgresql/files/list_publications.sh @@ -1,5 +1,5 @@ #!/bin/bash -for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1')"); do +for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1','postgres')"); do echo "DB: $db" psql -d "$db" -Atqc "SELECT pubname FROM pg_publication;" done diff --git a/site-cookbooks/kosmos_postgresql/files/list_subscriptions.sh b/site-cookbooks/kosmos_postgresql/files/list_subscriptions.sh index 30796d5..3d95308 100644 --- a/site-cookbooks/kosmos_postgresql/files/list_subscriptions.sh +++ b/site-cookbooks/kosmos_postgresql/files/list_subscriptions.sh @@ -1,5 +1,5 @@ #!/bin/bash -for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1')"); do +for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1','postgres')"); do echo "==== DB: $db ====" psql -d "$db" -c "SELECT * FROM pg_stat_subscription;" done diff --git a/site-cookbooks/kosmos_postgresql/templates/create_subscriptions.sh.erb b/site-cookbooks/kosmos_postgresql/templates/create_subscriptions.sh.erb index 8d79c73..9ee5078 100644 --- a/site-cookbooks/kosmos_postgresql/templates/create_subscriptions.sh.erb +++ b/site-cookbooks/kosmos_postgresql/templates/create_subscriptions.sh.erb @@ -3,7 +3,7 @@ set -e echo "== Creating subscriptions for all databases ==" -for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1')"); do +for db in $(psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN ('template1','postgres')"); do echo "Processing DB: $db" SLOT="migrate_slot_${db}"