Skip to content

Commit

Permalink
WIP. Get the list of databases in the database cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
justinclift committed Sep 30, 2024
1 parent c9b30d9 commit a7af88e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ _main() {
echo "Running pg_upgrade command, from $(pwd)"
echo "---------------------------------------"
bin_path=$(get_bin_path)
${bin_path}/pg_upgrade --username="${POSTGRES_USER}" --link -d "${OLD}" -D "${NEW}" -b "${OLDPATH}/bin" -B "${bin_path}" --socketdir="/var/run/postgresql"
"${bin_path}/pg_upgrade" --username="${POSTGRES_USER}" --link -d "${OLD}" -D "${NEW}" -b "${OLDPATH}/bin" -B "${bin_path}" --socketdir="/var/run/postgresql"
echo "--------------------------------------"
echo "Running pg_upgrade command is complete"
echo "--------------------------------------"
Expand Down Expand Up @@ -578,14 +578,11 @@ _main() {
echo "Reindexing the databases"
echo "------------------------"

# Start the database in single user mode
"${OLDPATH}/bin/postgres" --single -D "${POSTGRES_DB}"

# 1. Get the list of databases in the database cluster
# Something like this should work:
# SELECT datname FROM pg_catalog.pg_database WHERE datistemplate IS FALSE;
DB_LIST=$(echo 'SELECT datname FROM pg_catalog.pg_database WHERE datistemplate IS FALSE' | postgres --single -D /var/lib/postgresql/data 2>bar | grep datname | grep -v backend | cut -d '"' -f 2)

# 2. For each database, get the list of indexes

# 3. Regenerate the indexes

echo "-------------------------------"
Expand Down

0 comments on commit a7af88e

Please sign in to comment.