Bugs item #3426501, was opened at 2011-10-20 14:33
Message generated for change (Tracker Item Submitted) made by kenlalonde
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3426501&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Postgres
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ken Lalonde (kenlalonde)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug in string handling using postgresql 9.1
Initial Comment:
When using postgresql 9.1 with the default config settings, sqlobject incorrectly
handles strings containing C-style escapes.
For example, when creating an object Foo with StringCol "bar", this code:
Foo(bar='a\nb')
will generate something like:
INSERT into foo (bar) VALUES ('a\nb');
Under pre-9.1 versions, or 9.1 with config setting standard_conforming_string=off, "select bar from foo" will return a 3 character string.
Under pg 9.1, it returns a 4 character string, because \n is interpreted as 2 characters.
I guess one way around this would be to use postgresql's escape string syntax, since sqlobject is depending
on that behaviour:
INSERT into foo (bar) VALUES (E'a\nb');
But this will break pre-8.1 versions of postgresql that don't understand the E'' syntax.
In an ideal world, sqlobject would let the driver handle parameter conversion (psycopg2 does it correctly);
but perhaps that isn't feasible.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3426501&group_id=74338
|