BUG #4908: escaping and dollar quotes: "ERROR: unterminated string" - Mailing list pgsql-bugs

From Jack Douglas
Subject BUG #4908: escaping and dollar quotes: "ERROR: unterminated string"
Date
Msg-id 200907082053.n68Kr3Xm090266@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4908: escaping and dollar quotes: "ERROR: unterminated string"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4908
Logged by:          Jack Douglas
Email address:      jackpdouglas@gmail.com
PostgreSQL version: 8.3.7
Operating system:   Debian Lenny
Description:        escaping and dollar quotes: "ERROR:  unterminated
string"
Details:

Am I missing something obvious here - I understand from the documentation no
escapes are counted in dollar quoted strings?

postgres=> create or replace function temp() returns text language plpgsql
AS $$
postgres$> begin
postgres$>   return '\';
postgres$> end; $$;
ERROR:  unterminated string
CONTEXT:  compile of PL/pgSQL function "temp" near line 2

I use the following as a workaround:

postgres=> create or replace function temp() returns text language plpgsql
AS $$
postgres$> begin
postgres$>   return rtrim('\ ');
postgres$> end; $$;
CREATE FUNCTION

obviously this is a contrived test case to demonstrate the problem, not my
real function :-)

pgsql-bugs by date:

Previous
From: Alcione Bernardi
Date:
Subject: Re: BUG #4827: install
Next
From: Tom Lane
Date:
Subject: Re: BUG #4908: escaping and dollar quotes: "ERROR: unterminated string"