Does Replace function in postgres have except cases
How can i use the repla开发者_StackOverflowce function with some except conditions.
You can't. Try using a regular expression if you need more control over what is being replaced.
regexp_replace(string text, pattern text, replacement text [,flags text])
If regex isn't enough then create your own function in PL/pgSQL
How can i use the replace function with some except conditions.
Such as? Of course, SpliFF is absolutely right, you can use regexp_replace, as that would give you more control over what is matched, but in case you're talking about another condition, can't you just use a where clause?
UPDATE foo SET bar = REPLACE( bar, 'foo', 'bar' ) WHERE yourcondition IS TRUE;
精彩评论