Search Postgresql Archives

Re: Regex match not back-referencing in function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thom Brown <thom@xxxxxxxxx> 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.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux