Bug Tracker item #3023888, was opened at 2010-07-01 18:19 Message generated for change (Comment added) made by sberthelot You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=3023888&group_id=250683
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: daemon Group: v3.9.0 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Stéphane Berthelot (sberthelot) Assigned to: Stevan Bajic (sbajic) Summary: Wrong escaping of bytea (signature data) with postgresql 8.4 Initial Comment: Escaping of insertion has been modified in 3.9.0 in two ways : - using PQescapeByteaConn (instead of PQescapeBytea) - adding E'' syntax in INSERT But this encodes twice the data and then doesn't work on fresh PostgreSQL 8.4.2 with or without standard_conforming_string in either UTF8 or SQL_ASCII database encoding. Removing the E'' syntax (since the string is already correctly encoded now) makes signature insertion work again In the git code, it may be necessary to add the if construct in this patch to check about postgresql version (but <=7.4 seem not supported anymore officially by the postgres team now ...) ---------------------------------------------------------------------- >Comment By: Stéphane Berthelot (sberthelot) Date: 2010-08-05 12:00 Message: I know it's certainly not the failsafe way to fix the bug ... I was referring to http://www.postgresql.org/docs/8.4/static/datatype-binary.html (between table 8-7 and table 8-8) The pgsql doc says that the bytea are to be encoded twice since they are decoded first by the query analyzer then by the bytea processor. Removing the E'' syntax was the quickiest way for me to "fix it" (since with stock dspam 3.9.0 and stock postgresql 8.4 the signature data doesn't get inserted and return an encoding error) I agree with you on the syntax but it doesn't explain why it doesn't work with E'' and start working when I remove it ... The "correct" way to fix is certainly to replace queries containing bytea (that use string copy functions) by stored procedures instead. What do you think about it ? If ok I'll try to prepare a patch in this direction and test it. ---------------------------------------------------------------------- Comment By: Stevan Bajic (sbajic) Date: 2010-08-04 23:38 Message: > But this encodes twice the data > This is simply not true. The 'E' syntax is telling PostgreSQL that the data is not a string literal but a escaped string. That's all. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=3023888&group_id=250683 ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ Dspam-devel mailing list Dspam-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspam-devel