Re: Having issues inserting a string with a ' into a varchar column

From: Sbob <sbob(at)quadratum-braccas(dot)com>
To: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Having issues inserting a string with a ' into a varchar column
Date: 2022-04-15 18:02:57
Message-ID: a50a28fa-6f8b-4fd6-caa4-bcb0526fa5a5@quadratum-braccas.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

correction, the quote_ident below should be quote_literal

I did not try quote_ident

On 4/15/22 12:01, Sbob wrote:
>
> Hi all;
>
>
> I have a table that includes a varchar column.
>
> I am inserting some data and one of the strings = "Poker 5 card Hold'Em"
>
> as a straight string it errors out.
>
>
> I tried this :  quote_ident ( 'Poker 5 card Hold'Em')
>
> but it still error's out
>
>
> I also tried : quote_literal('Poker 5 card Hold\'Em')
>
> but it also errors out:
>
>
> psql:test.sql:1042: ERROR:  syntax error at or near "Em"
> LINE 1: ...ed) VALUES ( quote_literal('Poker 5 card Hold\\'Em'), 2, 1...
>
>
> Thanks in advance
>
>
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2022-04-15 18:16:31 Re: Having issues inserting a string with a ' into a varchar column
Previous Message Sbob 2022-04-15 18:01:31 Having issues inserting a string with a ' into a varchar column