question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add "replace" to update queries, just like in SQL

See original GitHub issue

Use case: Update several entries, where I need to replace a certain string value. There is no need to select the items.

Current solution: Select all desired entries and update one by one. This is a performance nightmare.

Feature description: When updating an entry, use the following syntax (works in “normal” SQL): UPDATE myTable set someValue=REPLACE(someValue, 'old text', 'new text') WHERE someID='71AD3D9C-7755-474D-BA78-B23AF9968030'

Would be great if this would work with crate as well.

Additional info: Should also be made available for updating arrays, where one could remove or add an item to the array(s if multiple entries), without actually fetching them.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mfusseneggercommented, Nov 28, 2018

We’ve merged a replace scalar with https://github.com/crate/crate/pull/7924, it will be available with 3.2

1reaction
ghostcommented, Oct 17, 2018

@hnstbndr Sorry for this, it seems this happened in error. We will reopen this, of course @mfussenegger also notified me about that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using REPLACE in an UPDATE statement - SQLTeam.com
The REPLACE function is easy to use and very handy with an UPDATE statment. ... is to use this in conjuntion with a...
Read more >
UPDATE and REPLACE part of a string - Stack Overflow
If the column to replace is type text or ntext you need to cast it to nvarchar. UPDATE dbo.xxx SET Value = REPLACE(CAST(Value...
Read more >
How to UPDATE from a SELECT statement in SQL Server
The conditional update statement is used to change the data that satisfies the WHERE condition. 1. 2. 3. UPDATE table.
Read more >
What is Replace in SQL and How to Use Replace() Function
Replace in SQL is a built-in function. Learn how to use Replace() function in SQL with the UPDATE statement and much more in...
Read more >
Search and Replace String in Database - SQL Tutorial
Sometimes, you want to search and replace a substring with a new one in a column e.g., change a dead link to a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found