From 4ddf0b77c9f0d44bddc3da691bc9aa30a3eaf565 Mon Sep 17 00:00:00 2001 From: az7961 Date: Tue, 3 Jun 2025 11:15:34 -0500 Subject: [PATCH] Critical for PG15+: allow user to create in public schema Change-Id: I2ba34c03dddd03d2e8bb8299d202e44be5d3113a --- helm-toolkit/templates/scripts/_db-pg-init.sh.tpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helm-toolkit/templates/scripts/_db-pg-init.sh.tpl b/helm-toolkit/templates/scripts/_db-pg-init.sh.tpl index 4d7dfaa378..fc5475686d 100644 --- a/helm-toolkit/templates/scripts/_db-pg-init.sh.tpl +++ b/helm-toolkit/templates/scripts/_db-pg-init.sh.tpl @@ -42,7 +42,7 @@ fi pgsql_superuser_cmd () { DB_COMMAND="$1" if [[ ! -z $2 ]]; then - EXPORT PGDATABASE=$2 + export PGDATABASE=$2 fi /usr/bin/psql \ -h ${DB_HOST} \ @@ -66,4 +66,7 @@ pgsql_superuser_cmd "GRANT ALL PRIVILEGES ON DATABASE $USER_DB_NAME to $USER_DB_ #revoke all privileges from PUBLIC role pgsql_superuser_cmd "REVOKE ALL ON DATABASE $USER_DB_NAME FROM PUBLIC;" + +#Critical for PG15+: allow user to create in public schema +pgsql_superuser_cmd "GRANT USAGE, CREATE ON SCHEMA public TO $USER_DB_USER;" "$USER_DB_NAME" {{- end }}