Migrate PostgreSQL cluster to PG14 #625

Merged
raucao merged 19 commits from feature/postgresql_migration into master 2026-04-12 14:16:22 +00:00
2 changed files with 15 additions and 4 deletions
Showing only changes of commit a89db454d0 - Show all commits

View File

@@ -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 (''template0'',''postgres'')" | \
psql -Atqc "SELECT datname FROM pg_database WHERE datallowconn AND datname NOT IN (''template1'',''postgres'')" | \

Why is it template0 instead of template1 like in all the other places?

Why is it `template0` instead of `template1` like in all the other places?

Ohai @fsmanuel, (very) long time no see!

That's a good catch, it should be template1, because template0 is automatically excluded by the preceding condition (it doesn't allow connections).

Thanks! 🙏

Ohai @fsmanuel, (very) long time no see! That's a good catch, it should be `template1`, because `template0` is automatically excluded by the preceding condition (it doesn't allow connections). Thanks! 🙏
xargs -I{} -P4 sh -c "
pg_dump -Fd -j 4 -d \"{}\" -f dump_{} &&
tar -cf - dump_{} | zstd -19 -T0 > dump_{}.tar.zst &&

View File

@@ -1,5 +1,16 @@
#!/bin/bash
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;"
set -euo pipefail
psql -Atqc "
SELECT datname
FROM pg_database
WHERE datallowconn
AND datname NOT IN ('template1','postgres')
" | while read -r db; do
result=$(psql -X -At -d "$db" -c "SELECT * FROM pg_stat_subscription;" 2>/dev/null || true)
if [[ -n "$result" ]]; then
echo "==== DB: $db ===="
echo "$result"
fi
done