Convert || to CONCAT

Proprietary

Replaces || string concatenation with a CONCAT call, which skips NULL operands as Oracle's || does, where PostgreSQL's || yields NULL. A bind parameter operand is cast to TEXT, as CONCAT accepts any type and so cannot infer one for an untyped parameter. Index expressions keep ||, as PostgreSQL does not allow CONCAT in them.

org.openrewrite.sql.ConvertConcatOperatorToFunction
mod run . --recipe=org.openrewrite.sql.ConvertConcatOperatorToFunction

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.