Skip to content

Commit dd67289

Browse files
author
Isaque Neves
committed
decode timestamp without timezone as local DateTime and decode timestamp with timezone respecting the timezone defined in the connection, timeZone option in ConnectionSettings is now a TimeZoneSettings type instead of String
1 parent 5de424b commit dd67289

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/src/connectors/postgres_connector.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class PostgresConnector extends Connector implements ConnectorInterface {
3939

4040
// if (config.containsKey('timezone') && config['timezone'] != null) {
4141
// var timezone = config['timezone'];
42-
// await connection.execute("set time zone '$timezone'");
42+
// await connection.execute("set timezone TO '$timezone'");
4343
// }
4444

4545
// Unlike MySQL, Postgres allows the concept of "schema" and a default schema

lib/src/pdo/postgres/postgres_pdo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class PostgresPDO extends PDOInterface {
100100
await conn.execute("SET search_path TO ${dsnParser.schema}");
101101
}
102102
if (dsnParser.timezone != null) {
103-
await conn.execute("SET time zone '${dsnParser.timezone}'");
103+
await conn.execute("SET timezone TO '${dsnParser.timezone}'");
104104
}
105105
if (dsnParser.applicationName != null) {
106106
await conn

lib/src/pdo/postgres_v3/postgres_v3_pdo.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class PostgresV3PDO extends PDOInterface {
107107
await conn.execute("SET search_path TO ${dsnParser.schema}");
108108
}
109109
if (dsnParser.timezone != null) {
110-
await conn.execute("SET time zone '${dsnParser.timezone}'");
110+
await conn.execute("SET timezone TO '${dsnParser.timezone}'");
111111
}
112112
if (dsnParser.applicationName != null) {
113113
await conn

0 commit comments

Comments
 (0)