Please sign in to comment.
Set standard_conforming_strings = ON by default when using PostgreSQL…
…, turn off with Sequel::Postgres.force_standard_strings = false PostgreSQL has two string modes, escaped (E'...') and unescaped ('...'). By default, you can use string escapes in an unescaped string, but that will change in a future version. It is recommended that you set standard_conforming_strings = ON when using PostgreSQL, though that will not be the default till a future version. Sequel expects the use of standard conforming strings, so it always uses unescaped strings. This brings up PostgreSQL warnings if the standard_conforming_strings setting was not set to ON in the PostgreSQL server configuration. With this commit, Sequel will changes the setting (since it can be specified per connection), unless you set Sequel::Postgres.force_standard_strings = false. The standard_conforming_strings is only available in PostgreSQL 8.2 and greater, but checking the server version at the point we want to change the setting would be quite complex considering all the underlying drivers that we support, so just send it unconditionally with a rescue so there shouldn't be an effect if the setting isn't available. For SQL:Blob values, use the extended string format when literalizing the value, since escape_bytea seems to require it. Without the extended string format, it appears to give the wrong value.
- Loading branch information...
Showing with 45 additions and 12 deletions.