Problem with apostrophes in TK frontend

Started by PostgreSQL Bugs Listover 25 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

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 single varchar column the error message was "Unterminated qouted string", more complicated records generated more confusing errors.

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

#2Chris
linux.fellow@libertysurf.fr
In reply to: PostgreSQL Bugs List (#1)
Re: Problem with apostrophes in TK frontend

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.