SCM

[#1009624] bytea and standard_confirming_strings

View Trackers | Patches | Download .csv | Monitor

Date:
2007-10-22 10:00
Priority:
3
State:
Closed
Submitted by:
Laurenz Albe (albe)
Assigned to:
Nobody (None)
Category:
Group:
Resolution:
None
 
Summary:
bytea and standard_confirming_strings

Detailed description
Since PostgreSQL 8.2 there is a new configuration parameter
"standard_conforming_strings". If set to the default value "off",
PostgreSQL will behave as in previous versions. When set to "on",
backslashes in string literales will not be interpreted as
escape characters, but as ordinary characters, unless you prepend
the opening single quote of the string constant with an E.

Npgsql has a problem with this if you use NpgsqlCommand without
Prepare(), because NpgsqlTypesHelper.ConvertToBackendPlainQuery
will use backslash as escape character but does not add the E.
The result is that, when "standard_conforming_strings" is on,
there will be one backslash too much in the string, leading to
corrupt bytea entries.

The problem is particularly aggrevating because, according to
current opinion, "on" will be the default setting from 8.4 on
(http://archives.postgresql.org/pgsql-hackers/2007-01/msg01575.php).

The two patches we submit will work around this problem by
forcing the traditional behavior by prepending an E to string
literales. One patch is for Npgsql, the other for Npgsql2.

Yours,
Laurenz Albe & Erich Lerch

Followup

Message
Date: 2009-02-17 04:25
Sender: Oli C

Thanks for the response. Appreciate all the work you guys are doing and looking for the next release.
Date: 2009-02-16 16:17
Sender: Laurenz Albe

The patch has not been applied to Npgsql2.

A better fix for the problem has been added, but this
currently is available only in CSV.
It will be included in the next release, and the problem
should be gone.
Date: 2009-02-12 22:19
Sender: Oli C

Hello,

Is this patch applied to 2.0.2?
Looked at the downloaded code and still see the pre-patch version.

thx

Attached Files:

Attachments:
Npgsql.patch.txt
Npgsql2.patch.txt

Changes:

Field Old Value Date By
close_date2009-02-16 16:172009-02-16 16:17albe
status_idOpen2009-01-16 12:40talliesin
close_date2009-01-16 12:402009-01-16 12:40talliesin
File Added258: Npgsql2.patch.txt2007-10-22 10:01albe
File Added257: Npgsql.patch.txt2007-10-22 10:00albe
Powered By FusionForge