fix(infra): bootstrap_glitchtip — \gexec instead of DO block (psql var trap) #219

Merged
lekss361 merged 1 commit from fix/glitchtip-bootstrap-gexec into main 2026-05-16 15:54:30 +00:00

1 commit

Author SHA1 Message Date
lekss361
a1091cdd5a fix(infra): bootstrap_glitchtip — \gexec instead of DO block (psql var trap)
psql variables (:'gt_pass') are substituted client-side in the psql stream
but NOT inside dollar-quoted DO $$..$$ bodies — those are sent to the server
as literal text, causing syntax error. Replace DO block with \gexec pattern:
quote_literal(:'gt_pass') builds the CREATE ROLE statement client-side, then
\gexec executes it. WHERE NOT EXISTS makes both role and DB steps idempotent.
Also connect to 'postgres' db (not app db) for CREATE DATABASE to work.
2026-05-16 18:28:42 +03:00