Re: [ dspam-Bug Tracker-3023888 ] Wrong escaping of bytea (signature data) with postgresql 8.4

Stevan Bajić <[email protected]>
Newsgroups gmane.mail.spam.dspam.devel
Message-ID <[email protected]>
On Mon, 23 Aug 2010 10:56:19 +0200
Marcin Mirosław <[email protected]> wrote:

> W dniu 23.08.2010 09:53, Stevan Bajić pisze:
> > Okay. Let's say I want to fix the PostgreSQL driver to take care of that setting.
> > So either I have to check for 'standard_conforming_strings' and look if it is set to 'on' or I write every text with the E'' notation and don't care about 'standard_conforming_strings' bein 'on' or 'off'. 
> 
> Sorry, i didn't read all thread. "standard_conforming_strings=on/off"
> can be set in any moment of connection to pgsql, let dspam set it on/off
> at the start, and go on with proper escaping.
>
Most data is just INT, BIGINT or DATE.

In three tables we use VARCHAR:
- In 'dspam_signature_data' for 'signature'
- In 'dspam_preferences' for 'preference' and 'value'
- In 'dspam_virtual_uids' for 'username'

In one table we use BYTEA:
- In 'dspam_signature_data' for 'data'

So the only place where we need to escape/unescape is the places where we use VARCHAR and BYTEA.

We could avoid escaping the VARCHAR for the table dspam_signature_data since that 'signature' will probably never have a character in it that would need escaping. In the 'dspam_preferences' table the 'preference' will too not have a character that needs escaping. But 'value' from 'dspam_preferences' could have characters that would need escaping/unescaping and the 'username' from 'dspam_virtual_uids' could have characters that need escaping/unescaping. The 'data' from 'dspam_signature_data' will probably always need to use E'' notation.

So IMHO the PostgreSQL driver should not fiddle around with 'standard_conforming_strings' and either enforce everywhere the E'' notation (would slow down the driver because of escaping/unescaping) or just use escaping/unescaping where we anyway can't go without (dspam_signature_data.data, dspam_virtual_uids.username and dspam_preferences.value).

What do you think about this approach?

> Regards,
> Marcin
> 
-- 
Kind Regards from Switzerland,

Stevan Bajić


> -- 
> xmpp (jabber): marcin  [at]  mejor.pl
> www: http://blog.mejor.pl/
> 

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

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Dspam-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-devel
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.