-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix a bug with returning_disabled when using the postgresql adapter #21697
Fix a bug with returning_disabled when using the postgresql adapter #21697
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @senny (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The returning_disabled configuration option is required to make postgresql partitioning triggers work. This commit fixes a bug where an invalid query would be made in cases where returning_disabled was true and objects were created with no attributes defined.
ad47a84
to
871f453
Compare
For extra clarity on this bug and fix, here's a very simple failing testcase: https://gist.github.com/gdeglin/a32541807ba366d57c57 The stack trace of the failure is:
You can see that Rails attempted to query a non-existent sequence. This is because it fails to fetch the table name correctly. This patch corrects a regular expression so that it does correctly fetch the table name in this case, and then queries the correct sequence. |
assert_equal expect.to_i, result.rows.first.first | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be more prudent about whitespace issues like this (your end
lines had trailing whitespace as well). We have to merge manually from the command line to fix issues like this, which takes a lot more time and means we can process fewer issues each day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll keep this in mind for next time. Thanks!
…_values_bug Fix a bug with returning_disabled when using the postgresql adapter
The returning_disabled configuration option is required to make postgresql partitioning triggers work. This commit fixes a bug where an invalid query would be made in cases where returning_disabled was true and objects were created with no attributes defined.
This fixes one of the issues I identified in #21659