diff --git a/doc/sql.extensions/README.time_zone.md b/doc/sql.extensions/README.time_zone.md index 5480cb1536..a924541aae 100644 --- a/doc/sql.extensions/README.time_zone.md +++ b/doc/sql.extensions/README.time_zone.md @@ -8,11 +8,13 @@ data types are defined to use the session time zone when converting from or to a `TIME` and `TIMESTAMP` are synonymous to theirs respectively `WITHOUT TIME ZONE` data types. The session time zone, as the name implies, can be a different one for each database attachment. -It can be set with the isc_dpb_session_time_zone DPB, and if not, it starts by default defined to be the -`firebird.conf` parameter `DefaultTimeZone` or the same time zone used by the Firebird OS process when the parameter is not defined. +It can be set (with this priority) using `isc_dpb_session_time_zone` DPB, the client's `firebird.conf` +parameter `DefaultTimeZone` and the server's `firebird.conf` parameter `DefaultTimeZone`. If none of these are set, +it starts using the same time zone used by the Firebird engine OS process. A change in `DefaultTimeZone` configuration or the OS time zone does not changes the default of a running Firebird process. -It can then be changed with `SET TIME ZONE` statement to a given time zone or reset to its original value with `SET TIME ZONE LOCAL`. +The session time zone can be changed with `SET TIME ZONE` statement to a given time zone or reset to its original value +with `SET TIME ZONE LOCAL`. The original time zone value is initially defined equal to the current time zone in session initialization and cannot be changed manually. But the original time zone is internally changed when a routine (function, procedure or trigger) diff --git a/src/yvalve/why.cpp b/src/yvalve/why.cpp index f615b72c52..e0a096f2a5 100644 --- a/src/yvalve/why.cpp +++ b/src/yvalve/why.cpp @@ -6192,11 +6192,18 @@ YAttachment* Dispatcher::attachOrCreateDatabase(CheckStatusWrapper* status, bool // Take care about DPB setLogin(newDpb, false); - if (!utfData) + + if (!newDpb.find(isc_dpb_session_time_zone)) { - IntlDpb().toUtf8(newDpb); + const char* defaultTimeZone = Config::getDefaultTimeZone(); + + if (defaultTimeZone && defaultTimeZone[0]) + newDpb.insertString(isc_dpb_session_time_zone, defaultTimeZone); } + if (!utfData) + IntlDpb().toUtf8(newDpb); + // Take care about filename PathName orgFilename(filename); if (utfData)