-
Notifications
You must be signed in to change notification settings - Fork 96
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
Quote table names in generated SQL #41
Comments
Cool, good catch. I'll try to get a fix up for this soon. The quoting part is easy, just need to make sure we match regenerated trigger definitions (now with quotes) to existing ones in the db (possibly without), so we can avoid mismatches ... be nice to have the actual |
Great, thanks. In the mean time I worked around it by using a manual migration definition and quoting the table name like this: create_trigger("user_after_insert_row_tr", compatibility: 1).
on('"user"').
... |
@bsutherland note that once I push a gem and you upgrade to it, you'll probably want to go back and remove the quoting from your manual migration |
@jenseng Thanks for the fixes! |
no problem, thanks for the bug reports 👍 |
@jenseng, I've upgraded to the latest version, and went back to remove the quoting, but I'm having trouble. This was what I had (to workaround the issue)
With the new version, this gets double-quoted and fails (as expected). But, when I change to:
It doesn't get quoted at all! I took a look at the commit that fixed it, but I'm not really sure what's going on. Your help would be greatly appreciated! |
We have a table named "user". In Postgres this is a reserved word, so the following SQL generated by hair_trigger fails:
DROP TRIGGER IF EXISTS user_after_update_of_login_id_row_tr ON user;
This could be solved by escaping table names in all generated SQL (in the case of postgres, using double quotes):
DROP TRIGGER IF EXISTS user_after_update_of_login_id_row_tr ON "user";
The text was updated successfully, but these errors were encountered: