David Fetter <david(at)fetter(dot)org> writes:
> CREATE OR REPLACE FUNCTION has_bad_chars(text) RETURNS BOOLEAN
> AS $function$
> SELECT $1 ~ $q$[\t\r\n\v|$qq$\$qq$]$q$;
> $function$ LANGUAGE SQL;
Why would you expect that to work? Dollar-quote is not a construct
known to any regex engine that I know about. What you've got there
is a bracket expression redundantly matching the set of characters
\t \r \n \v | $ q
(I think that's what it will be read as, anyway, but I'm not a
regexp guru...)
regards, tom lane