-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
PostgreSQL: Fix db:structure:load silent failure on SQL error #24773
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @kaspth (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. |
cc @arthurnn |
64c64e0
to
36fb2ca
Compare
The command line flag "-v ON_ERROR_STOP=1" should be used when invoking psql to make sure errors are not suppressed. Example: psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db Fixes rails#23818.
36fb2ca
to
09a90bb
Compare
r? @arthurnn |
thanks , and sorry for taking so long to review it. |
@ralinc - I wish this feature had shipped with a way to disable this behavior. I upgraded to Rails 5.1 and this change has broken all of my CI and Heroku automation. The CI server appears to be running I have no easy way to disable this feature b/c an environmental flag has been embedded in this I'm also confused by the OP's original issue and am not 100% sure why this would even be approved and merged into ActiveRecord. A command line flag like this can be added on one's own by just appending it onto their command like this: IMHO, this was a hastily implemented and not thoroughly reviewed feature. Is it possible to roll it back? (I know I can by forking ActiveRecord ;) ) |
@danielricecodes I don't like the change either but have managed to work around this by creating a custom task that leverages namespace :db do
namespace :structure do
desc "Disable exit-on-error behaviour when loading db structure in postgresql"
task disable_errors: :environment do
ActiveRecord::Tasks::DatabaseTasks.structure_load_flags = ["-v", "ON_ERROR_STOP=0"]
end
end
end So, for my heroku automation it is now |
PostgreSQL: Fix db:structure:load silent failure on SQL error
The command line flag "-v ON_ERROR_STOP=1" should be used when invoking psql to make sure errors are not suppressed.
Example:
psql -v ON_ERROR_STOP=1 -q -f awesome-file.sql my-app-db
Fixes #23818.