-
-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add session time zone to system context #6786
Comments
This is overkill IMO as the information is already present in We should better add extension to EXTRACT returning region string and let people use that EXTRACT extension with |
The standard |
Agree |
Isn't MON$TIMESTAMP connection time? Will it be changed after "SET TIME ZONE" issued? |
Except it isn't available in select cast(mon$timestamp as varchar(50)) from mon$attachments where mon$attachment_id = current_connection;
-- Output: 2021-05-03 13:11:22.7720 Europe/Amsterdam
set time zone 'America/New_York';
select cast(mon$timestamp as varchar(50)) from mon$attachments where mon$attachment_id = current_connection;
-- Output: 2021-05-03 13:11:22.7720 Europe/Amsterdam After connecting with select cast(mon$timestamp as varchar(50)) from mon$attachments where mon$attachment_id = current_connection;
-- Output: 2021-05-03 14:38:31.7910 Europe/Amsterdam |
And to be clear, this isn't just about getting the time zone, it is also about providing a consistent API. That is, if session idle timeout is available from |
So I think we should change it to use
It should not be changed, but should it be a real problem? |
I don't see why it should. That column provides when the server received the connection. Having this report it in the time zone of the server is perfectly fine and logical. Changing it to reflect the current session time zone sounds like an abuse to avoid creating a logical API. |
So you do not want to solve any real problem? Then there is more work for you (how do one read set bindinds, etc). |
EXTRACT allows to work with any timestamp, from any source. It is more general and I see no reason to not implement it. As for:
use current_timestamp, not mon$timestamp |
I'm currently updating the Language Reference, and I foresee and expect that people will want to know this information.
Well, yes, I argue those should also be exposed as well. Personally, I'd be fine with exposing this only through |
And I repeat, that is a workaround at best. It also doesn't allow an administrator to see this information in |
I don't agree with you. The server receives a connection and can store that client time zone in the field. It's not documented in any place nor was the intention to hide that. Moreover, in |
About |
Even if you do that, this would - I assume - still be the initial time zone of the session, not the current time zone of the session, unless you plan to rebase |
That is fine with me, although I would argue that |
Sure, the initial (or original) time zone. I created #6787 for that. |
Ok, but to be explicit: that wouldn't match what I request, namely a way to obtain the current session time zone. |
Ok. I may see the value of it for debug purposes (not API consistency). Let's see how/when #6789 can be merged and also when an ODS change to MON could be done. |
On 5/3/21 3:14 PM, Vlad Khorsun wrote:
MON$TIME_ZONE in MON$ATTACHMENTS
This is overkill IMO as the information is already present in
|MON$TIMESTAMP|.
We should better add extension to EXTRACT returning region string
and let people use that EXTRACT extension with |MON$TIMESTAMP|.
Agree
+1
That's more universal approach, it can extract time zone from any
timestamp, not only current.
|
The SQL spec has both CURRENT_USER and SESSION_USER and our CURRENT_USER actually behaves as standard's SESSION_USER. So I suppose one day we'll include SESSION_USER too and thus SESSION_TIMEZONE would be pretty consistent. |
I have changed title to match what was been committed in v4.0. |
New pull request created with the other part of this original issue. |
Currently it is not possible to obtain the current session time zone other than through workarounds like
substring(current_timestamp from 26)
.I think we should add:
RDB$GET_CONTEXT('SYSTEM', 'SESSION_TIME_ZONE')
MON$TIME_ZONE
inMON$ATTACHMENTS
Both should return the current session time zone (either named zone or offset in {+|-}HH:MM).
This would be similar to what is provided for the session idle timeout, which is accessible from the system context using
RDB$GET_CONTEXT('SYSTEM', 'SESSION_IDLE_TIMEOUT')
and fromMON$IDLE_TIMEOUT
inMON$ATTACHMENTS
.Desired situation:
and
The text was updated successfully, but these errors were encountered: