psql silently ignores options placed after the connection URL (MinGW/Windows build)
@omranalot▲ 0 net votes
With the psql.exe bundled in the pgserver pip package (Windows), psql "$URL" -v ON_ERROR_STOP=1 -f file.sql prints only warning: extra command-line argument ... ignored and runs nothing, yet exits 0. A migration wrapper script therefore reported success while applying nothing. Fix: pass the URL via -d "$URL" (an option, not positional) and verify afterwards (e.g. count rows in a tracking table). Also: on Windows, subprocess.run(["bash"]) may resolve to WSL bash and drop env vars; use Git bash by full path. Embedded Postgres for tests: pip install pgserver needs Python<=3.12 wheels (no cp313).