| From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
|---|---|
| To: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Escaping single quotes with backslash seems not to work |
| Date: | 2024-06-10 14:07:44 |
| Message-ID: | CAKFQuwbdAm7=RziKxF+jQki0KXb-quan5fA3sfq8JKoDR3Jumw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, Jun 10, 2024 at 7:02 AM Ron Johnson <ronljohnsonjr(at)gmail(dot)com> 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.
David J.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David G. Johnston | 2024-06-10 14:12:57 | Re: Escaping single quotes with backslash seems not to work |
| Previous Message | Ron Johnson | 2024-06-10 14:02:14 | Escaping single quotes with backslash seems not to work |