Postgres 8.4 literal escaping

From: Niederland <niederland(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Postgres 8.4 literal escaping
Date: 2009-07-08 22:21:01
Message-ID: ff1a179c-b184-4bb3-9cbb-afc2f8ca5550@k19g2000yqn.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

with Postgres 8.4:

SQL 1: update customer set note = ('A' || '\r\n' || 'B') where 1=0;

generates:
WARNING: nonstandard use of escape in a string literal
LINE 1: update customer set note = ('A' || '\r\n' || 'B') where 1=0;
^
HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
(Note is of datatype TEXT)

SQL 2: select ('A' || '\r\n' || 'B') as tt from customer limit 1
Functions without escaping literal

On postgres 8.3.7 both of the above SQLs function without requiring
any literals to be escaped.

This seems inconsistent to me in that I would have thought that in
Postgres 8.4 either both SQLs would have required escaping or neither
of them would have required escaping.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-07-08 22:22:54 Re: Checkpoint Tuning Question
Previous Message John Cheng 2009-07-08 22:15:08 Re: Problem search on text arrays, using the overlaps (&&) operator