BUG #4027: backslash escaping not disabled in plpgsql

From: "Jonathan Guthrie" <jguthrie(at)brokersys(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4027: backslash escaping not disabled in plpgsql
Date: 2008-03-11 21:26:56
Message-ID: 200803112126.m2BLQuf0060841@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


The following bug has been logged online:

Bug reference: 4027
Logged by: Jonathan Guthrie
Email address: jguthrie(at)brokersys(dot)com
PostgreSQL version: 8.3.0
Operating system: Debian Gnu/Linux "unstable" 2.6.24
Description: backslash escaping not disabled in plpgsql
Details:

I have set the standard_conforming_strings to "on" in my settings, and have
verified it by executing a

select '\';

which works fine and produces the expected:
?column?
----------
\
(1 row)

However, when I attempt to define this function:

create function foo (out r refcursor) as $bar$
begin
open r for
select * from user_data
where name_first like name escape '\';
end; $bar$ language plpgsql;

it complains about an unterminated string. ("ERROR: unterminated string")
However, if I double the backslashes, it compiles just fine, and does not
emit a warning even though escape_string_warning is also set to 'on'. As
expected, the system does emit a warning when I double the backslashes and
when standard_conforming_strings is set to 'off'. I also have
backslash_quote set to 'off', but it doesn't seem to change anything in this
case.

I believe that this is incorrect behavior and that the backslash should be
just a character in that string when standard_conforming_strings is set to
'on'.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2008-03-11 23:31:27 Re: [BUGS] psql \COPY accepts multiple NULL AS
Previous Message Tom Lane 2008-03-11 21:17:33 Re: BUG #4026: Displaying Wrong dates

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2008-03-11 22:18:46 Re: COPY issue(gsoc project)
Previous Message Bruce Momjian 2008-03-11 21:13:22 Re: Restartable signals 'n all that