rails
rails copied to clipboard
SQLite3 support use returning statement
Summary
SQLite(3.35.0) release information The SQLite add support for the RETURNING clause on DELETE, INSERT, and UPDATE statements. This PR used this feature, as follows:
-
ActiveRecord::InsertAll
support use to returning of feature if your SQLite version >= 3.35.0. -
ActiveRecord::ConnectionAdapters::AbstractAdapter#exec_insert
support return primary key of value directly. If you want to keep original behavior, you can setinsert_returning: false
in connection configuration of database.
PS: English is not my native language; please excuse typing errors.
I have a look CI test and I do not found SQLite's version information. It may not be able to test fot the SQLite‘s returning caluse feature and maybe need use newer SQLite.
I run test is pass locally and I use 3.36.0 SQLite.
If I understand it well, CI is running in Docker image based on Debian 11 and installing Sqlite3 using system package.
https://packages.debian.org/bullseye/sqlite3
Currently it is using 3.34.1-3
version.
If I understand it well, CI is running in Docker image based on Debian 11 and installing Sqlite3 using system package.
https://packages.debian.org/bullseye/sqlite3
Currently it is using
3.34.1-3
version.
Thanks for your reply. Maybe we should wait for the sqlite3 version to upgrade, and then look at this PR.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Reopened another closed by stale label.
@OuYangJinTing Would you rebase this pull request based on the latest main branch if you are still interested in. Thanks.
@yahonda I re-checked and updated the commit. Can you help to re-review? thank you! I will add returning statement ability for mariadb if this PR can be merged
Hey folks, I'd like to see if https://github.com/rails/rails/pull/49290 achieved everything we aimed for in this PR so this one could be closed.
@nvasilevski: I opened #50468 to add the documentation improvements, but everything else in this PR was captured by #49290. Once #50468 is merged, this can be closed. @OuYangJinTing, I made sure to make you a co-author of the #50468 PR. Thanks for your good work here.
Closing as completed by #49290 and #50468