Thread: Problem with apostrophes in TK frontend

Problem with apostrophes in TK frontend

From
pgsql-bugs@postgresql.org
Date:
Hramrach (hramrach@centrum.cz) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Problem with apostrophes in TK frontend

Long Description
I tried to enter data using pgaccess but I was unable to enter any text containing ' (apostroph). Portgres writes:

ERROR:  Unterminated quoted string

When I enter "\'" - apostroph preceded by a backslash, the text is
inserted. When the table is reopened, it's displayed without the backslash. I tried several tables. In table with
singlevarchar column the error message was "Unterminated qouted string", more complicated records generated more
confusingerrors. 

I'm using Postgres 7.1 beta 1 on a RedHat 6.0 system with Tcl/Tk 8.0
(it's written in the manpage - I don't know how get the version from
tcl/wish).


Sample Code
An examle copied from sql window - the text is apparently incorrectly quoted:

insert into "tab1" ("taet","text","text2","id") values ('skldgj 'dgk dlf','dgsdfkl gh ;sdfgh dlfkgh','dfl;sj
gkl;j','456464654')

ERROR:  parser: parse error at or near "dgk"


No file was uploaded with this report

Re: Problem with apostrophes in TK frontend

From
Chris
Date:
> insert into "tab1" ("taet","text","text2","id") values ('skldgj 'dgk dlf','dgsdfkl gh ;sdfgh
> dlfkgh','dfl;sj gkl;j','456464654')
>
> ERROR:  parser: parse error at or near "dgk"
>

Of course it is not correctly quoted. If you want to insert a quote in the
string, just put it twice.

insert into "tab1" ("taet","text","text2","id") values ('skldgj ''dgk
dlf','dgsdfkl gh ;sdfgh
dlfkgh','dfl;sj gkl;j','456464654')

if you want to insert a backslash, it's the same :

insert into "tab1" ("text") values ('need a \\ ?');

Hope this will solve your problem.