diff --git a/Dockerfile-postgres b/Dockerfile-postgres index 76453cbc28..d436268350 100644 --- a/Dockerfile-postgres +++ b/Dockerfile-postgres @@ -22,7 +22,8 @@ RUN echo -e "#!/bin/sh -e \n\ echo aws_s3.endpoint_url='http://localstack:4566' >> $PGCONFFILE \n\ echo aws_s3.access_key_id='localstack' >> $PGCONFFILE \n\ echo aws_s3.secret_access_key='localstack' >> $PGCONFFILE \n\ -psql -a -d postgres -U postgres -c \"SELECT pg_reload_conf();CREATE USER ro_user WITH SUPERUSER ENCRYPTED PASSWORD 'password';GRANT pg_read_all_data TO ro_user;GRANT pg_write_server_files TO ro_user;\" > /dev/null \n\ +psql -a -d postgres -U postgres -c \"SELECT pg_reload_conf();DROP USER IF EXISTS ro_user;CREATE USER ro_user WITH SUPERUSER ENCRYPTED PASSWORD 'password';GRANT pg_read_all_data TO ro_user;GRANT pg_write_server_files TO ro_user;\" > /dev/null \n\ +psql -a -d postgres -U postgres -c \"DROP DATABASE IF EXISTS postgres_db2;\" > /dev/null \n\ psql -a -d postgres -U postgres -c \"CREATE DATABASE postgres_db2;\" > /dev/null \n\ " > /docker-entrypoint-initdb.d/cfg_s3_dummy.sh diff --git a/xyz-psql-connector/src/main/java/com/here/xyz/psql/factory/MaintenanceSQL.java b/xyz-psql-connector/src/main/java/com/here/xyz/psql/factory/MaintenanceSQL.java index ebfb8af43d..58f9dad851 100644 --- a/xyz-psql-connector/src/main/java/com/here/xyz/psql/factory/MaintenanceSQL.java +++ b/xyz-psql-connector/src/main/java/com/here/xyz/psql/factory/MaintenanceSQL.java @@ -89,6 +89,19 @@ public static String generateEnsureCorrectVersionSQL(String schema){ * Install all required database extensions */ public static String generateMandatoryExtensionSQL(){ + return "DO $$ " + + "BEGIN " + + "CREATE EXTENSION IF NOT EXISTS postgis SCHEMA public; " + + "CREATE EXTENSION IF NOT EXISTS postgis_topology; " + + "CREATE EXTENSION IF NOT EXISTS tsm_system_rows SCHEMA public; " + + "CREATE EXTENSION IF NOT EXISTS dblink SCHEMA public; " + + "CREATE EXTENSION IF NOT EXISTS plv8 SCHEMA pg_catalog; " + + "CREATE EXTENSION IF NOT EXISTS aws_s3 CASCADE; " + + "END; " + + "$$;"; + } + + public static String _generateMandatoryExtensionSQL(){ return "DO $$ " + "BEGIN " + "CREATE EXTENSION IF NOT EXISTS postgis SCHEMA public; " + diff --git a/xyz-util/src/main/resources/sql/common.sql b/xyz-util/src/main/resources/sql/common.sql index 196435f813..2aa84e10ed 100644 --- a/xyz-util/src/main/resources/sql/common.sql +++ b/xyz-util/src/main/resources/sql/common.sql @@ -26,17 +26,7 @@ DO $installExtensions$ CREATE EXTENSION IF NOT EXISTS postgis_topology; CREATE EXTENSION IF NOT EXISTS tsm_system_rows SCHEMA public; CREATE EXTENSION IF NOT EXISTS dblink SCHEMA public; - BEGIN - CREATE EXTENSION IF NOT EXISTS plpython3u CASCADE; - EXCEPTION WHEN OTHERS THEN - RAISE NOTICE 'Not able to install plpython3u extension'; - END; CREATE EXTENSION IF NOT EXISTS aws_s3 CASCADE; - BEGIN - CREATE EXTENSION IF NOT EXISTS aws_lambda CASCADE; - EXCEPTION WHEN OTHERS THEN - RAISE NOTICE 'Not able to install aws_lambda extension'; - END; END; $installExtensions$;