Re: Regex match not back-referencing in function

From: Thom Brown <thom(at)linux(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Regex match not back-referencing in function
Date: 2012-02-12 18:59:58
Message-ID: CAA-aLv4aj07zyP-4vfyo=urnX+qyEykf8CBi=kFyULL6wKD7Rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12 February 2012 18:49, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thom Brown <thom(at)linux(dot)com> writes:
>> What am I missing?
>
> I might be more confused than you, but I think you're supposing that
> the result of ascii(E'\\1') has something to do with the match that
> the surrounding regexp_replace function will find, later on when it
> gets executed.  The actual arguments seen by regexp_replace are
>
> regression=# select E'Hello & goodbye ',E'([&])','&#' ||
> ascii(E'\\1') || E';\\1';
>     ?column?     | ?column? | ?column?
> ------------------+----------+----------
>  Hello & goodbye  | ([&])    | &#92;\1
> (1 row)
>
> and given that, the result looks perfectly fine to me.
>
> If there's a bug here, it's that ascii() ignores additional bytes in its
> input instead of throwing an error for a string with more than one
> character.  But I believe we've discussed that in the past and decided
> not to change it.

Okay, in that case I made the wrong assumptions about order of resolution.

Thanks

--
Thom

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Waddy 2012-02-12 19:42:37 CREATE TABLE AS does not support IF NOT EXISTS?
Previous Message David Johnston 2012-02-12 18:54:35 Re: Regex match not back-referencing in function