Bug reference: 18715 Logged by: Chris Email address: xpusostomos@gmail.com PostgreSQL version: 16.5 Operating system: Linux Description:
OK, but now imagine that at runtime the 3rd argument is null... and we expect it to be null because that variable is not used in that tuple: replace('abcdef', '${m}', null) => null
This is not a bug. Replace is defined to return null on null input (i.e., strict) and that is the behavior you are seeing.
Use Coalesce to convert your null into an empty string.