This PR adds support for RETURNING clauses in DELETE statements specifically for MariaDB databases. MariaDB has supported the RETURNING clause in DELETE statements since version 10.0.5.
Changes:
Introduce feature.DeleteReturning because the existing feature.Returning is used in UpdateQuery, but MySQL/MariaDB don't support RETURNING clause in UPDATE statements
Add feature.DeleteReturning to all dialects already having feature.Returning for backward compatibility
Add feature.DeleteReturning to mysql dialect for MariaDB 10.0.5 and later
Replace feature.Returning with feature.DeleteReturning in DeleteQuery
Add check for feature.DeleteReturning in DeleteQuery.Returning method because previously, Returning could be used for the mysql dialect but didn't receive any error or result
MariaDB doesn't support 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:
Not directly related to this PR: There is feature.InsertReturning, but InsertQuery.tryLastInsertID checks feature.Returning. Is this correct?
After this PR, feature.Returning will be used only in UpdateQuery. I propose renaming it to feature.UpdateReturning to clarify its usage. This renaming has not been implemented yet.
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: