BUG #4908: escaping and dollar quotes: "ERROR: unterminated string"

From: "Jack Douglas" <jackpdouglas(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4908: escaping and dollar quotes: "ERROR: unterminated string"
Date: 2009-07-08 20:53:03
Message-ID: 200907082053.n68Kr3Xm090266@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4908
Logged by: Jack Douglas
Email address: jackpdouglas(at)gmail(dot)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 :-)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-07-08 21:06:00 Re: BUG #4908: escaping and dollar quotes: "ERROR: unterminated string"
Previous Message Alcione Bernardi 2009-07-08 20:25:54 Re: BUG #4827: install