MariaDB: add support for RETURNING clause in DELETE statements #1059
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for
RETURNING
clauses inDELETE
statements specifically for MariaDB databases. MariaDB has supported theRETURNING
clause inDELETE
statements since version 10.0.5.Changes:
feature.DeleteReturning
because the existingfeature.Returning
is used inUpdateQuery
, but MySQL/MariaDB don't supportRETURNING
clause inUPDATE
statementsfeature.DeleteReturning
to all dialects already havingfeature.Returning
for backward compatibilityfeature.DeleteReturning
tomysql
dialect for MariaDB 10.0.5 and laterfeature.Returning
withfeature.DeleteReturning
inDeleteQuery
feature.DeleteReturning
inDeleteQuery.Returning
method because previously,Returning
could be used for themysql
dialect but didn't receive any error or resultExample usage:
Notes:
RETURNING
clause for multi-table deletes but I haven't add any check for that because I don't know is any other database supports this.Discussion:
feature.InsertReturning
, butInsertQuery.tryLastInsertID
checksfeature.Returning
. Is this correct?feature.Returning
will be used only inUpdateQuery
. I propose renaming it tofeature.UpdateReturning
to clarify its usage. This renaming has not been implemented yet.References: