Re: Dollar quoting inside a regex bracket expression

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Dollar quoting inside a regex bracket expression
Date: 2004-09-27 03:45:42
Message-ID: 18124.1096256742@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Aleksey Fedorchenko 2004-09-27 07:56:42 Re: BUG #1266: Improper unique constraint / MVCCactivitieswithin
Previous Message David Fetter 2004-09-27 02:29:45 Dollar quoting inside a regex bracket expression