Bugs item #3426501, was opened at 2011-10-20 22:33
Message generated for change (Comment added) made by phd
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: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Ken Lalonde (kenlalonde)
Assigned to: Oleg Broytman (phd)
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.
----------------------------------------------------------------------
>Comment By: Oleg Broytman (phd)
Date: 2011-10-31 17:51
Message:
Thank you for looking at it. Will be in the next release 1.2. I'm going to
release the first beta RSN.
----------------------------------------------------------------------
Comment By: Ken Lalonde (kenlalonde)
Date: 2011-10-31 17:41
Message:
Looks reasonable. Thanks Oleg.
----------------------------------------------------------------------
Comment By: Oleg Broytman (phd)
Date: 2011-10-29 17:52
Message:
Can you apply the patch in the revision 4465
(https://sourceforge.net/mailarchive/forum.php?thread_name=E1RK96B-0007ug-M0%40webwareforpython.org&forum_name=sqlobject-cvs)
or checkout the trunk and test it?
----------------------------------------------------------------------
Comment By: Oleg Broytman (phd)
Date: 2011-10-20 22:49
Message:
This is certainly a problem I want to fix urgently because our company is
going to upgrade to PostgreSQL 9.1. Postgres 8.1 is old enough (November of
2005, see http://www.postgresql.org/docs/8.1/static/release-8-1.html), so I
can drop support for older versions without too much troubles for users.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3426501&group_id=74338
|