Commit ef2f4b9a authored by fnux's avatar fnux

__postgres_*: fix forgotten edge cases in delimited identifier escape

parent 3258fc98
......@@ -43,10 +43,14 @@ if [ "$state_should" != "$state_is" ]; then
if [ -f "$__object/parameter/owner" ]; then
owner="-O \"$(cat "$__object/parameter/owner")\""
fi
echo "su - '$postgres_user' -c \"createdb $owner \"$name\"\""
cat << EOF
su - '$postgres_user' -c "createdb $owner \"$name\""
EOF
;;
absent)
echo "su - '$postgres_user' -c \"dropdb \"$name\"\""
cat << EOF
su - '$postgres_user' -c "dropdb \"$name\""
EOF
;;
esac
fi
......@@ -53,11 +53,13 @@ case "$state_should" in
done
[ -n "$password" ] && password="PASSWORD '$password'"
cmd="CREATE ROLE \"$name\" WITH $password $booleans"
echo "su - '$postgres_user' -c \"psql postgres -wc \\\"$cmd\\\"\""
cat << EOF
su - '$postgres_user' -c "psql postgres -wc 'CREATE ROLE \"$name\" WITH $password $booleans;'"
EOF
;;
absent)
echo "su - '$postgres_user' -c \"dropuser \\\"$name\\\"\""
cat << EOF
su - '$postgres_user' -c "dropuser \"$name\""
EOF
;;
esac
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment