Re: PostgreSQL warnings filling up the logs with PickleCol

Oleg Broytman <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
Hello!

On Thu, May 31, 2012 at 08:08:42AM +0200, Tom Coetser <[email protected]> wrote:
> I am getting a warning in the Postgres log for every time a PickleCol is 
> written to the database. Since my app uses a pickled col extensively in one of 
> the more frequently used tables, the Postgres logs are filled with these 
> warnings:
> 
> ----------------------
> WARNING:  nonstandard use of \\ in a string literal at character 50
> HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
> ----------------------

   Thank you for an example of a good bug report! An error message and a
short test case - exactly what I need.
   Can you apply and test the attached patch?

> Any help on how to solve this so I can get my log files cleaned up, in order 
> to debug another connection problem, would be greatly appreciated.

   What log files? /var/log/postgresql/*.log?

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
pgconnection.py.patch (text/x-diff, 465 B)
--- pgconnection.py	2012-05-13 19:45:45.000000000 +0400
+++ pgconnection.py.distr	2012-05-31 11:36:56.000000000 +0400
@@ -359,4 +359,9 @@
 # Converter for psycopg Binary type.
 def PsycoBinaryConverter(value, db):
     assert db == 'postgres'
-    return str(value)
+    s = str(value)
+    if ('\\' in s):
+        if s.startswith("'") and s[-8:].lower().endswith("'::bytea"):
+            return "E'%s'::bytea" % s[1:-8]
+        return "E'%s'" % s
+    return s
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.