Friday, April 12, 2024

A week of fixes

Posted by Greg

Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.

Fix union select parentheses
When building UNION or UNION ALL queries involving LIMIT or ORDER BY, Arel generated invalid SQL previously. This pull request changes Arel::Visitors::ToSql so that SELECT statements in Union and UnionAll nodes are enclosed in parentheses to avoid syntax errors.

Fix copying virtual columns when altering a table in SQLite3
When Rails alters a SQLite table, it creates a new table and copies the structure and data from the old one.
The problem is that virtual columns are incorrectly copied (copied as classic columns). This pull request fixes that.

Fix ActiveJob::EnqueueAfterTransactionCommit API
perform_later is supposed to return the Job instance on success, and false on error. When the enqueue is automatically delayed, it is of course impossible to predict if the actual queueing will succeed, but for backward compatibility reasons, it is best to assume it will.
If necessary, you can hold onto the job instance and check for #successfully_enqueued? after the transaction has completed.

You can view the whole list of changes here.
We had 31 contributors to the Rails codebase this past week!

Until next time!

Subscribe to get these updates mailed to you.