sulfinu@gmail.com writes:
> I would like to be able to use a variable inside the like_regex predicate,
> at least for the pattern.
This was discussed before [1]. The restriction to a constant pattern
is per SQL spec. It's not entirely clear to us why the spec is
written that way, but there may be some actual semantic point behind
it. In any case, if you want to propose a patch, that thread would
probably be the best place to do it.
regards, tom lane
[1]
https://www.postgresql.org/message-id/flat/CAGHENJ4A8awD2uXHkf50eV%2B9wyiDm3eP%2BG10J09%2B0VRmXBQAdw%40mail.gmail.com