From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Rich Shepard <rshepard(at)appl-ecosys(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: INSERT INTO: string with apostrophe |
Date: | 2017-06-29 21:04:00 |
Message-ID: | CAKFQuwYtZuGu9cqcG5YzKe_ab7nV1jFT3jVJPbXnz8gG6itL8A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Jun 29, 2017 at 1:36 PM, Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:
> On Thu, 29 Jun 2017, Cachique wrote:
>
> That is correct. You can double the single quotes. Another way is to use
>> the E'...' syntax (i.e., E'O\'Brien'). Or you can use the quote_*
>> functions (
>> https://www.postgresql.org/docs/current/static/functions-string.html)
>>
>
> Walter,
>
> Thanks for confirming.
>
I don't know how you'd use the quote_literal with a literal input.
PostgreSQL also offers a feature called dollar-quoting. If you place two
dollar signs surrounding an optional string before and after the text.
i.e., $txt$I've got an unescaped quote in me$txt$
These can be nested, and are particularly useful when writing function
bodies.
These and more syntax rules can be found here:
https://www.postgresql.org/docs/9.6/static/sql-syntax.html In this case
section "4.1.2 Constants"
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Melvin Davidson | 2017-06-29 21:21:18 | Re: duplicate key value violates unique constraint and duplicated records |
Previous Message | Rich Shepard | 2017-06-29 20:36:39 | Re: INSERT INTO: string with apostrophe |