Skip to content

Commit

Permalink
Correct schema name quoting
Browse files Browse the repository at this point in the history
Currently, certain `ALTER... SCHEMA` statements will fail if they address a
schema whose name contains a hyphen, which can happen, for instance, managing
the personal schema of a user whose name contains a hyphen. This commit wraps
the schema name in quotes for the two affected sql queries, and bumps pgbedrock
to 0.3.2.

Closes #43.
  • Loading branch information
rectangular-zone committed Jul 20, 2018
1 parent 2139bf8 commit e0b6dcc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pgbedrock/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '0.3.1'
__version__ = '0.3.2'
LOG_FORMAT = '%(levelname)s:%(filename)s:%(funcName)s:%(lineno)s - %(message)s'
4 changes: 2 additions & 2 deletions pgbedrock/privileges.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
Q_REVOKE_NONDEFAULT = 'REVOKE {} ON {} {} FROM "{}";'
Q_GRANT_DEFAULT = """
SET ROLE "{}";
ALTER DEFAULT PRIVILEGES IN SCHEMA {} GRANT {} ON {} TO "{}";
ALTER DEFAULT PRIVILEGES IN SCHEMA "{}" GRANT {} ON {} TO "{}";
RESET ROLE;
"""
Q_REVOKE_DEFAULT = """
SET ROLE "{}";
ALTER DEFAULT PRIVILEGES IN SCHEMA {} REVOKE {} ON {} FROM "{}";
ALTER DEFAULT PRIVILEGES IN SCHEMA "{}" REVOKE {} ON {} FROM "{}";
RESET ROLE;
"""

Expand Down

0 comments on commit e0b6dcc

Please sign in to comment.