From a0264e5e94e5b58faf4971c6ef903cef4dcd706e Mon Sep 17 00:00:00 2001 From: oliver Date: Wed, 6 May 2026 17:13:31 +0800 Subject: [PATCH] fix(setup): escape DO $$ in PowerShell heredoc Use escaped $$ delimiters inside the SQL block so PowerShell does not treat them as interpolation and break init_pg on first-run setup. Co-authored-by: Cursor --- scripts/init_pg.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/init_pg.ps1 b/scripts/init_pg.ps1 index 91e8dff..00480ab 100644 --- a/scripts/init_pg.ps1 +++ b/scripts/init_pg.ps1 @@ -45,7 +45,7 @@ $env:PGPASSWORD = $SuperPassword try { Write-Host "==> Ensuring role '$NetxUser'" $roleSql = @" -DO $$ +DO `$\$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = '$NetxUser') THEN CREATE ROLE $NetxUser LOGIN PASSWORD '$NetxPassword'; @@ -53,7 +53,7 @@ BEGIN ALTER ROLE $NetxUser WITH LOGIN PASSWORD '$NetxPassword'; END IF; END -$$; +`$\$; "@ Invoke-Psql -Database "postgres" -Sql $roleSql