fix(sql): move ROLE PASSWORD outside DO block (psql skips :var in dollar-quoting)

This commit is contained in:
User
2026-07-12 17:12:26 +02:00
parent 67d030b24d
commit 3f816044c3
2 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -5,10 +5,11 @@
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'thoth_dwh_reader') THEN
CREATE ROLE thoth_dwh_reader LOGIN PASSWORD :'PWD';
CREATE ROLE thoth_dwh_reader LOGIN;
END IF;
END $$;
-- :'PWD' va fuori dal DO (psql non interpola nelle stringhe dollar-quoted)
ALTER ROLE thoth_dwh_reader PASSWORD :'PWD';
GRANT USAGE ON SCHEMA datawarehouse TO thoth_dwh_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA datawarehouse TO thoth_dwh_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA datawarehouse