Thread: pgsql ODBC text escaping issue
Hi all, I have a problem on text escaping. In my application, I have a table offlinemsg, which has one column id with long, and has another column msg with text. pgsql ODBC and dynamic SQL binding was used when I tried to insert data into offlinemsg. the sql is : insert into offlinemsg values(?, ?) and the msg value is: <msg='test', from='ss' to='dd'/> During test, I found that ODBC will automatically add escaping to the value, so the msg value will be tranfer to: <msg=\\'test\\', from=\\'ss\\' to=\\'dd\\'/>, then final sent to postgres server. Becuase this escaping transition is not standard, the postgres server will log a warning in the pg_log, which is: 2011-07-17 16:53:24 CST WARNING: nonstandard use of \' in a string literal at character 82 2011-07-17 16:53:24 CST HINT: Use '' to write quotes in strings, or use the escape string syntax (E'...'). Since we have massive this kind of offline message, after several days, the disk is full of pg_log and postgres services down. The ODBC version we used is 07.03.0100. Is it a known issue? How to avoid the massive warning log? Thanks very much! Br, Zhidong
Have you tried one of the newer ODBC drivers? Also, you may want to look into enabling standard_conforming_strings or disabling the warning messages with escape_string_warning.
Jon
From: Zhidong She <zhidong.she@gmail.com>
To: pgsql-odbc@postgresql.org, pgsql-general@postgresql.org, Zhidong She <zhidong.she@gmail.com>
Date: 07/20/2011 03:58 AM
Subject: [ODBC] pgsql ODBC text escaping issue
Sent by: pgsql-odbc-owner@postgresql.org
Hi all,
I have a problem on text escaping. In my application, I have a table
offlinemsg, which has one column id with long, and has another column
msg with text.
pgsql ODBC and dynamic SQL binding was used when I tried to insert
data into offlinemsg.
the sql is : insert into offlinemsg values(?, ?)
and the msg value is: <msg='test', from='ss' to='dd'/>
During test, I found that ODBC will automatically add escaping to the
value, so the msg value will be tranfer to: <msg=\\'test\\',
from=\\'ss\\' to=\\'dd\\'/>, then final sent to postgres server.
Becuase this escaping transition is not standard, the postgres server
will log a warning in the pg_log, which is:
2011-07-17 16:53:24 CST WARNING: nonstandard use of \' in a string
literal at character 82
2011-07-17 16:53:24 CST HINT: Use '' to write quotes in strings, or
use the escape string syntax (E'...').
Since we have massive this kind of offline message, after several
days, the disk is full of pg_log and postgres services down.
The ODBC version we used is 07.03.0100.
Is it a known issue? How to avoid the massive warning log?
Thanks very much!
Br,
Zhidong
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Jon
From: Zhidong She <zhidong.she@gmail.com>
To: pgsql-odbc@postgresql.org, pgsql-general@postgresql.org, Zhidong She <zhidong.she@gmail.com>
Date: 07/20/2011 03:58 AM
Subject: [ODBC] pgsql ODBC text escaping issue
Sent by: pgsql-odbc-owner@postgresql.org
Hi all,
I have a problem on text escaping. In my application, I have a table
offlinemsg, which has one column id with long, and has another column
msg with text.
pgsql ODBC and dynamic SQL binding was used when I tried to insert
data into offlinemsg.
the sql is : insert into offlinemsg values(?, ?)
and the msg value is: <msg='test', from='ss' to='dd'/>
During test, I found that ODBC will automatically add escaping to the
value, so the msg value will be tranfer to: <msg=\\'test\\',
from=\\'ss\\' to=\\'dd\\'/>, then final sent to postgres server.
Becuase this escaping transition is not standard, the postgres server
will log a warning in the pg_log, which is:
2011-07-17 16:53:24 CST WARNING: nonstandard use of \' in a string
literal at character 82
2011-07-17 16:53:24 CST HINT: Use '' to write quotes in strings, or
use the escape string syntax (E'...').
Since we have massive this kind of offline message, after several
days, the disk is full of pg_log and postgres services down.
The ODBC version we used is 07.03.0100.
Is it a known issue? How to avoid the massive warning log?
Thanks very much!
Br,
Zhidong
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc