-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JOIN
s in UpdateStatement
(join_subquery
, inner_join
, etc.)
#608
Comments
SeaQuery has support for |
I'm afraid these aren't supported by MariaDB. But I might be missing something... Update Syntax is documented here: https://mariadb.com/kb/en/update/ And Is If |
Sad, we only got I think it can be added. |
That would be greatly appreciated! =) |
Any news on this? |
@AdamJSoftware I put up a PR that at least partially addresses it. Not sure how to get traction on getting it merged though 🤔 |
@tyt2y3 @LeoniePhiline any idea who to ping about the PR for this? |
They'll have been notified already. |
@LeoniePhiline it's been ~3 weeks without so much as a comment on the open PR. I hate to be a bother, but do you happen to know if there is a way I might be able to expedite movement on that front? Even a "hate everything about it, will not merge" would be better than radio silence at this point IMO 😅 |
You could ask on the discord server. |
Motivation
It is rather handy (and often required?) to gather related entities in an
UPDATE
statement, and update some fields based on joined tables.For example, here each
institution
has severalsubscriptions
(withsubscriptions.institution
being a foreign key toinstitutions.uid
).An append-only activity table records users of these institutions using the subscriptions.
Periodically, the institutions' and subscriptions'
last_activity
datetime field shall be updated.Updating
last_activity
on subscriptionsUpdating
last_activity
on institutionsMy wish here was to use (simplified):
But joins are unavailable on
UpdateStatement
.Proposed Solutions
Add methods available on
SelectStatement
toUpdateStatement
:join
join_as
join_lateral
join_subquery
inner_join
left_join
right_join
full_outer_join
Additional Information
I will try to work around this using CTEs (Edit: This workaround won't work in MariaDB: https://jira.mariadb.org/browse/MDEV-18511UpdateStatement::with
).This feature request for
UPDATE TABLE ... JOIN ... SET ...
is related to #627 - a feature request forDELETE ... FROM ... JOIN ...
.The text was updated successfully, but these errors were encountered: