PgSQL query warning

Chris Moules <[email protected]> Wed, 12 Jun 2013 11:56:07 +0200
Newsgroups gmane.mail.spam.dspam.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------000900080905000601040104
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

During some recent testing I was getting:
'WARNING:  nonstandard use of \\ in a string literal'
'HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.'

I believe the query in question was not updated since PgSQL 7 times.

Patch attached, not heavily tested as I do not use PgSQL in production.
Maybe a dspam & PgQSL expert can check this. If PgSQL is constantly
issuing warnings, I can imagine that it slows it down a fraction.

Regards

Chris

--------------000900080905000601040104
Content-Type: text/x-diff;
 name="dspam_pgsql.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="dspam_pgsql.patch"

diff -ru dspam-3.10.2+dfsg.orig/src/pgsql_drv.c dspam-3.10.2+dfsg/src/pgsql_drv.c
--- dspam-3.10.2+dfsg.orig/src/pgsql_drv.c    2013-06-06 18:03:11.000000000 +0200
+++ dspam-3.10.2+dfsg/src/pgsql_drv.c   2013-06-11 12:56:53.355966746 +0200
@@ -1537,7 +1537,7 @@
   }
 
   snprintf (scratch, sizeof (scratch),
		   -            "INSERT INTO dspam_signature_data (uid,signature,length,created_on,data) VALUES (%d,'%s',%lu,CURRENT_DATE,'",
		   +            "INSERT INTO dspam_signature_data (uid,signature,length,created_on,data) VALUES (%d,'%s',%lu,CURRENT_DATE,E'",
		                (int) p->pw_uid, sig_esc, (unsigned long) SIG->length);
   free(sig_esc);
      buffer_cat (query, scratch);


--------------000900080905000601040104
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
--------------000900080905000601040104
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Dspam-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-devel

--------------000900080905000601040104--