In our case , we were using this merge query in application code(in Java) as a framework to dynamically take these values as bind values and do the merge of input data/message.
I’d do most anything before resorting to dynamic SQL. Usually one can simply write: values ($1::timestamptz) without resorting to a catalog lookup.
Or maybe write a function to do the merge. Or maybe insert to a temporary table then merge that.
David J.