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

Support FROM clause in UpdateBuilder #82

Closed
scags9876 opened this issue Feb 6, 2017 · 7 comments
Closed

Support FROM clause in UpdateBuilder #82

scags9876 opened this issue Feb 6, 2017 · 7 comments

Comments

@scags9876
Copy link

Trying to construct an update statement like the following in squirrel is proving impossible:

-- Update value in table a for all rows where the associated table b row has specified value in test_column
UPDATE table_a
SET table_a.value_column = $1
FROM table_b
WHERE table_b.a_id = table_a.id 
and table_b.test_column =  $2

I think UpdateBuilder should support a FROM clause to be able to leverage the abilities of postgres updates syntax: https://www.postgresql.org/docs/current/static/sql-update.html

@sdalezman
Copy link

We have a few scenarios where this would be helpful like when we have a large number of rows that we know the exact values to update. We're right now constructing this query ourselves

I'm happy to open a pr adding support for this, but just wanted to make sure it's something that will be accepted/there's interest for before doing the work

also just want to say we love the lib!

@lann
Copy link
Member

lann commented Sep 17, 2018

I've generally tried to avoid dialect-specific methods, but since there isn't a good way to work around this one I'd accept a new UpdateBuilder From method here.

@mlaflamm
Copy link
Contributor

Why is this issue closed? There is a PR but it is still open.

mlaflamm added a commit to mlaflamm/squirrel that referenced this issue Jul 28, 2020
mlaflamm added a commit to mlaflamm/squirrel that referenced this issue Jul 28, 2020
@mlaflamm
Copy link
Contributor

mlaflamm commented Jul 28, 2020

I've created a new PR (#256) that corrects the original one (#168)

@cjea
Copy link

cjea commented Mar 13, 2021

Any update on this?

@ysomad
Copy link

ysomad commented Mar 23, 2022

Any updates on this?

@denolehov
Copy link

Any update on this? The issue is closed, but the PR is open 😓

ovadbar added a commit to ovadbar/squirrel that referenced this issue Apr 3, 2023
joshring added a commit to joshring/squirrel that referenced this issue Feb 22, 2024
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

7 participants