pgbedrock
pgbedrock copied to clipboard
Support schema names with dashes
Summary Postgres doesn't like dashes in identifiers. To solve this, we can double-quote identifiers. We currently do this for tables and rolenames, but we don't do it for schemas. As a result, a spec like the below will cause an error:
zmarine:
can_login: true
owns:
schemas:
- schema-with-dash
privileges:
tables:
read:
- schema-with-dash.*
Postgres will complain that there is a syntax error at or near "-"
. To resolve this, we should double-quote all schemas as well.
Key Actions
- Identify all places where schemas are used and ensure they are double-quoted. This will likely just be modifying the queries within context.py to make sure they all double-quote schemas, but there may be downstream places that do comparisons / lookups of a schema and don't double-quote it.
- In addition, the submodules that use schemas (
ownerships.py
andprivileges.py
) will need to quote schemas that they are working with to make sure lookups with context.py work properly. - This is true for all other issues as well, but we definitely want a test here to verify that this behavior works as expected.
Ah. Totally missed this in my cursory glance over the issue tracker. Erghm.