postgresql - Using concat() function, is specific cases -
i need concatenate regexp pattern pieces, pattern, use c-style escape e.
if use concatenation operator ||, works:
e'a{'||2||'}' does not make sense, interes, how concatenate same, using concat() function ?
the misunderstanding this: c-style escapes way input string literals. when concatenate strings, || operator or concat() function (postgres 9.1+), method how individual strings input irrelevant.
in addition that, literals of other types (like numeric constant 2 in example) coerced text automatically.
on top of that, example not exhibit characters special meaning in escape strings (like \).
select e'a{' || 2 || '}'; select concat(e'a{', 2, '}'); so, e totally irrelevant in particular example.
since mention regexp patterns: tend have \ in them, have escaped \ in e'' notation:
select e'\\.' || 2 || '\.'; the modern way not use escape strings @ if not necessary. that's why postgres switched standard_conforming_strings = on postgresql 9.1. setting tested with.
Comments
Post a Comment