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

Cannot use FROM with multiple table names #160

Open
designermonkey opened this issue Mar 7, 2018 · 3 comments
Open

Cannot use FROM with multiple table names #160

designermonkey opened this issue Mar 7, 2018 · 3 comments

Comments

@designermonkey
Copy link

The following is expected:

UPDATE "themes", "entities"
SET
    "themes"."name" = :themes.name
WHERE
    "entities"."uuid" = :uuid

instead when doing ->table(Tables::THEMES . ', ' . Tables::ENTITIES) I get:

UPDATE "themes," "entities"
SET
    "themes"."name" = :themes.name
WHERE
    "entities"."uuid" = :uuid

and when doing ->table(Tables::THEMES . ' , ' . Tables::ENTITIES) I get:

UPDATE "themes" "," "entities"
SET
    "themes"."name" = :themes.name
WHERE
    "entities"."uuid" = :uuid
@harikt
Copy link
Member

harikt commented Mar 7, 2018

Interesting. Have never used something like this before.

What are you actually trying to do here?

Do you have any extra things in the where clause ? If not I believe all themes.name will be replaced.

Normally we can keep themes.entities_uuid if we need to only update one . But I am not completely aware of what you are doing here.

@designermonkey
Copy link
Author

The expected query is a way of getting around not being able to do joins in update statements. While it is valid for MySQL, it isn't for SQLite, so the alternative is a subselect.

I thought it best to mention this though. Could things like this be documented as 'not possible'?

@pmjones
Copy link
Member

pmjones commented Mar 8, 2018

I could see where the relevant Update classes could be modified to handle multiple calls to table() and comma-separate them on output. @designermonkey if you want to submit a PR for that I'd be happy to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants