Skip to content

Commit

Permalink
Escape in SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickEvers committed Apr 11, 2024
1 parent 749b3dc commit 3cba587
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ data:
exit 1
fi
echo "Delete databases starting with {{ POSTGRES_PREFIX }}"
"SELECT 'DROP DATABASE ' || quote_ident(datname) || ' WITH (FORCE);' FROM pg_database WHERE datname LIKE '{{ POSTGRES_PREFIX }}%' \gexec" | psql -d postgres -w
echo "SELECT 'DROP DATABASE ' || quote_ident(datname) || ' WITH (FORCE);' FROM pg_database WHERE datname LIKE '{{ POSTGRES_PREFIX | replace('_','#_')}}%' ESCAPE '#' \gexec" | psql -d postgres -w
echo "Delete users starting with {{ POSTGRES_PREFIX }}"
"SELECT 'DROP USER ' || quote_ident(usename) || ';' FROM pg_catalog.pg_user WHERE usename LIKE '{{ POSTGRES_PREFIX }}%' \gexec" | psql -d postgres -w
echo "SELECT 'DROP USER ' || quote_ident(usename) || ';' FROM pg_catalog.pg_user WHERE usename LIKE '{{ POSTGRES_PREFIX | replace('_','#_')}}%' ESCAPE '#' \gexec" | psql -d postgres -w

0 comments on commit 3cba587

Please sign in to comment.