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

Bulk update support #52

Closed
lorefnon opened this issue Oct 24, 2022 · 3 comments
Closed

Bulk update support #52

lorefnon opened this issue Oct 24, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@lorefnon
Copy link
Contributor

lorefnon commented Oct 24, 2022

Hello, hope you are doing well.

Is it possible to construct a bulk update query that does not need a temporary table (supported by postgres) :

   UPDATE REGISTRATION AS t
   SET name = c.column_name, modified = c.column_date_modified
   FROM (
      VALUES  (1, 'test one', '12–12–2019'),
      (2, 'test two', '12–12–2019'),
      (3, 'test three','12–12–2019'),
      (4, 'test four', '12–12–2019')
   ) AS c(column_id, column_name, column_date_modified)
   WHERE c.column_id = t.id

The values construct is described here.

@juanluispaz
Copy link
Owner

Hi,

I will implement it (the values construction you showed me in your example) , just let me figure out a convenient way to do it

@juanluispaz juanluispaz added the enhancement New feature or request label Oct 30, 2022
juanluispaz added a commit that referenced this issue Nov 27, 2022
… use in the query with a list of constant provided values #52
juanluispaz added a commit that referenced this issue Nov 27, 2022
…"view" for use in the query with a list of constant provided values #52
juanluispaz added a commit that referenced this issue Nov 27, 2022
…at allows to create a "view" for use in the query with a list of constant provided values #52
@juanluispaz
Copy link
Owner

Implemented in ts-sql-query 1.41.0 already published. Implement this feature was challenging because corner cases, specially in PostgreSQL.

Some documentation:

Can you review it and let me know any feedback?

@lorefnon
Copy link
Contributor Author

This is great, thanks a lot. This will simplify a bunch of places where we are using raw sql now.

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

No branches or pull requests

2 participants