public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ron Johnson <[email protected]>
To: pgsql-general <[email protected]>
Subject: Re: Escaping single quotes with backslash seems not to work
Date: Mon, 10 Jun 2024 10:52:10 -0400
Message-ID: <CANzqJaCL_p2LmCAUPGUYxOJPN-iOs-JWbpU4ssH+rSw27DmvhA@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwbdAm7=RziKxF+jQki0KXb-quan5fA3sfq8JKoDR3Jumw@mail.gmail.com>
References: <CANzqJaD0=V+Dh+mLLfLj4ECLHriAH122LiYaqKyAnWCAKCfa6A@mail.gmail.com>
	<CAKFQuwbdAm7=RziKxF+jQki0KXb-quan5fA3sfq8JKoDR3Jumw@mail.gmail.com>

On Mon, Jun 10, 2024 at 10:08 AM David G. Johnston <
[email protected]> wrote:

> On Mon, Jun 10, 2024 at 7:02 AM Ron Johnson <[email protected]>
> wrote:
>
>> PG 9.6 and PG 14
>>
>>
>> https://www.postgresql.org/docs/14/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS
>>
>> [quote]
>> Any other character following a backslash is taken literally. Thus, to
>> include a backslash character, write two backslashes (\\). Also, a
>> single quote can be included in an escape string by writing \', in
>> addition to the normal way of ''.
>> [/quote]
>>
>>
> The link you provided goes to the wrong subsection.  The following
> subsection, which discusses, String Constants With C-Style Escapes,
> requires that you write the literal as E'abc\'def'
>
> Note the E prefix on the literal, which is the thing that enables
> considering backslash as an escape.
>

This hasn't changed from 9.6, has it?

A Java app that uses backslash escapes broke this morning on fields with
single quotes, after the weekend migration from PG 9.6.24 to 14.12, and I
don't know why.  I'm not a Java programmer, though.


view thread (7+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Escaping single quotes with backslash seems not to work
  In-Reply-To: <CANzqJaCL_p2LmCAUPGUYxOJPN-iOs-JWbpU4ssH+rSw27DmvhA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox