不要怂,就是干,撸起袖子干!

Commit 95a5c0d8 by Jan Aagaard Meier

Set standard_confirming_strings=on on connection in postgres. Closes #3545

1 parent 314eac84
# Next
- [BUG] Enable standards conforming strings on connection in postgres. Adresses [#3545](https://github.com/sequelize/sequelize/issues/3545)
# 2.0.6 # 2.0.6
- [BUG] Don't update virtual attributes in Model.update. Fixes [#2860](https://github.com/sequelize/sequelize/issues/2860) - [BUG] Don't update virtual attributes in Model.update. Fixes [#2860](https://github.com/sequelize/sequelize/issues/2860)
- [BUG] Fix for newlines in hstore [#3383](https://github.com/sequelize/sequelize/issues/3383) - [BUG] Fix for newlines in hstore [#3383](https://github.com/sequelize/sequelize/issues/3383)
......
...@@ -94,9 +94,15 @@ ConnectionManager.prototype.connect = function(config) { ...@@ -94,9 +94,15 @@ ConnectionManager.prototype.connect = function(config) {
connection._invalid = true; connection._invalid = true;
}); });
}).tap(function (connection) { }).tap(function (connection) {
if (self.sequelize.config.keepDefaultTimezone) return; // Disable escape characters in strings, see https://github.com/sequelize/sequelize/issues/3545
var query = 'SET standard_conforming_strings=on;';
if (!self.sequelize.config.keepDefaultTimezone) {
query += 'SET client_min_messages TO warning; SET TIME ZONE INTERVAL \'' + self.sequelize.options.timezone + '\' HOUR TO MINUTE';
}
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
connection.query('SET client_min_messages TO warning; SET TIME ZONE INTERVAL \'' + self.sequelize.options.timezone + '\' HOUR TO MINUTE').on('error', function (err) { connection.query(query).on('error', function (err) {
reject(err); reject(err);
}).on('end', function () { }).on('end', function () {
resolve(); resolve();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!