Skip to content
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

[5.8] Fix DELETE queries with alias on SQLite #29164

Merged
merged 2 commits into from Jul 15, 2019

Conversation

@staudenmeir
Copy link
Contributor

commented Jul 14, 2019

DELETE queries with an alias don't work on SQLite:

DB::table('users as u')->join('posts', 'posts.user_id', '=', 'u.id')->delete();

// expected
delete from "users" as "u" where "rowid" in (
  select "u"."rowid" from "users" as "u"
  inner join "posts" on "posts"."user_id" = "u"."id"
)

// actual
delete from "users" as "u" where "rowid" in (
  select "users" as "u.rowid" from "users" as "u"
         ^^^^^^^^^^^^^^^^^^^^
  inner join "posts" on "posts"."user_id" = "u"."id"
)

Fixes #29141.

@driesvints

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

@staudenmeir thanks!

@taylorotwell

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

Conflicts here.

@staudenmeir

This comment has been minimized.

Copy link
Contributor Author

commented Jul 15, 2019

@taylorotwell Resolved.

@taylorotwell taylorotwell merged commit 4b0cdaf into laravel:5.8 Jul 15, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@staudenmeir staudenmeir deleted the staudenmeir:delete-alias branch Jul 15, 2019

@driesvints

This comment has been minimized.

Copy link
Member

commented Jul 16, 2019

@staudenmeir small tip: if you rebase your branch instead of merging you prevent the extra merge commit from being added. This keeps the commit history a little cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.