Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-hackers by date

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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group