I want to permissions to a user named foo-bar in PostgreSQL (the key is that the username has a minus '-' in it). However, when I use GRANT ALL PRIVILEGES ON DATABASE baz TO foo-bar
, postgres complains about the minus character being invalid syntax. I figured that made sense, I just needed to use a string literal or escape the minus. However, trying the double dollar sign literal syntax here and prepending an E
as suggested here didn't work (presumably because the username isn't considered a string here).
So that begs the question, how does one refer to a user in postgres if the user has a minus in their name?