Re: Having issues inserting a string with a ' into a varchar column - Mailing list pgsql-admin

From Sbob
Subject Re: Having issues inserting a string with a ' into a varchar column
Date
Msg-id a50a28fa-6f8b-4fd6-caa4-bcb0526fa5a5@quadratum-braccas.com
Whole thread Raw
In response to Having issues inserting a string with a ' into a varchar column  (Sbob <sbob@quadratum-braccas.com>)
List 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



pgsql-admin by date:

Previous
From: Sbob
Date:
Subject: Having issues inserting a string with a ' into a varchar column
Next
From: "David G. Johnston"
Date:
Subject: Re: Having issues inserting a string with a ' into a varchar column