Remix.run Logo
mdaniel 13 hours ago

Fun fact: psql has a syntax through which one can use a form of prepared statements to avoid exploding when the password contains sql-sensitive characters[1]: https://www.postgresql.org/docs/17/app-psql.html#APP-PSQL-OP... and https://www.postgresql.org/docs/17/app-psql.html#APP-PSQL-IN... although regrettably it is not compatible with the "-c" invocation for some terrible reason, thus requiring the SQL to actually come from stdin:

  psql --set newpass="bobby';--drop table" <<'FOO'
  ALTER USER postgres WITH PASSWORD :'newpass';
  FOO

1: https://github.com/vitabaks/autobase/blob/e93fbe0c667c18a24e...
vitabaks 12 hours ago | parent [-]

Thanks. Feel free to suggest a PR.