From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Marc Mamin <marc(at)intershop(dot)de> |
Cc: | pgsql-bugs <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #6057: regexp_replace & back references |
Date: | 2011-06-14 19:47:59 |
Message-ID: | 1308080704-sup-5009@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Excerpts from Marc Mamin's message of mar jun 14 12:31:34 -0400 2011:
>
> The following bug has been logged online:
>
> Bug reference: 6057
> Logged by: Marc Mamin
> Email address: marc(at)intershop(dot)de
> PostgreSQL version: 9.0.4
> Operating system: Windows
> Description: regexp_replace & back references
> Details:
>
> select regexp_replace ('a','(a)','\\1'||substring('\\1',1,1)||'\\1','g')
> = a\1
> I'd expect a\1a as result.
Note that the substring returns a single character which is a literal \.
That \ escapes the \ in the final '\\1', which turns into the literal \
that you see in the result. The subsequent 1 is the leftover char from
the final '\\1'.
I think this is clearer if you set standard_conforming_strings to on.
--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Flower | 2011-06-15 02:40:32 | Re: PG 9.1 regression / row comparison? |
Previous Message | Rikard Pavelic | 2011-06-14 17:47:09 | BUG #6058: psql password prompt |