Re: Escaping single quotes with backslash seems not to work

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: Escaping single quotes with backslash seems not to work
Дата
Msg-id CANzqJaCL_p2LmCAUPGUYxOJPN-iOs-JWbpU4ssH+rSw27DmvhA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Escaping single quotes with backslash seems not to work  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Escaping single quotes with backslash seems not to work
Re: Escaping single quotes with backslash seems not to work
Список pgsql-general
On Mon, Jun 10, 2024 at 10:08 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Mon, Jun 10, 2024 at 7:02 AM Ron Johnson <ronljohnsonjr@gmail.com> wrote:
PG 9.6 and PG 14

[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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Dominique Devienne
Дата:
Сообщение: libpq v17 PQsocketPoll timeout is not granular enough
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Escaping single quotes with backslash seems not to work