add support for joins on delete #89
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "add-delete-join-support"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@lunny is the failing build due to something I've done? It looks like the build is not respecting the go.mod go version?
Looks like golang.org/x/tools v0.1.12 now require go 1.18
Should I address that in this PR or would you rather it be addressed in a separate PR and I rebase onto that?
@ -25,2 +26,3 @@
return b.cond.WriteTo(w)
if len(b.joins) > 0 {
parts := strings.Split(b.from, " ")
b.from?
The goal here is when one or more joins are specified, we want to get the table alias or name for the following syntax:
It is required to specify the table you want the deletes to occur in when referencing multiple tables.
https://dev.mysql.com/doc/refman/8.0/en/delete.html
In this line of code, I am getting the last part of the
b.from
(which is the table name or its alias) and specifying to use it for deletes.This approach means there is no way to specify that you want to delete from
t1
andt2
, but short of changing theDelete()
definition and behavior, I don't see a great way to do so.Is this a standard SQL syntax? Where could I find some related articles?
It seems to be supported in MySQL, MSSQL.
https://www.educba.com/sql-delete-join/
However, it does not seem to be supported in Postgres, SQLite, or Oracle.
I sent #90, let's wait it's merged.
You can rebase now since #90 merged.
85bf0f0c36
toae37c24c1e
@lunny have you had a chance to review this PR?
Pull request closed