-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pgbedrock
errors on usernames with hyphens if that user also has a personal schema
#43
Comments
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.
Hey Ross, greetings from the other side. :) Yeah, this is a known bug and is recorded in issue #7. As a result, I'm closing this issue as a duplicate. I think this should be doable to solve. It requires changing how an ObjectName instance's qualified_name is rendered (which is just an if-else), but the reason I didn't address it when implementing ObjectNames in the first place was a wrinkle in loading the YAML, as noted in this comment. If you'd like to take a crack at it, please do! Otherwise it'll probably stay an open issue for a while. I'm happy to sync though if there's interest. |
Hey @zmarine! I hope things on the other side are well. Unless I'm missing something, I think this issue is a more limited sub-issue of #7; I believe this issue should be adequately addressed by #44. While I'm also game to take on #7, it seems like it lays the groundwork for fully-qualified objects (e.g. |
Perhaps more generally: it seems there's some confusion here in how we expect quotes to be applied around objects that need them. In many places, quotes are provided in the query template strings themselves; #44 addresses this by adding them in even more places. #7 seems like it requires re-factoring quote handling to make it the responsibility of an object to know how it should be rendered (though, most of the time, a "quote all the things" approach is likely to be both safe and harmless). |
Hey Ross, that makes some sense to me. My one concern is whether you could then end up in a state where I'll be heading to Ethiopia today and likely won't be online much, so from my perspective if you can verify that both the generate and configure components work with dashes then feel free to merge. I'm not sure if anyone else is an admin in this repo yet, but if not they probably should be. |
Unless I'm misreading something, we have a test for this already, which has been passing this whole time: oh boy |
So: we have a test that makes this claim:
However: the test case is too small. It isn't until a certain threshold of complexity is hit that I've added a test for this failure case; I'm going to push it to the branch with an open PR so the failing case can be tracked. My existing solution is definitely not enough. |
Given a user:
The following error is returned by Postgres:
pgbedrock
should be fully quotingcaptain-planet
, which it does many places, but not, alas, enough places.The text was updated successfully, but these errors were encountered: