Skip to content
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 support for get / show timezone #3255

Closed
Tracked by #3148
avantgardnerio opened this issue Aug 24, 2022 · 4 comments · Fixed by #3485
Closed
Tracked by #3148

Add support for get / show timezone #3255

avantgardnerio opened this issue Aug 24, 2022 · 4 comments · Fixed by #3485
Labels
enhancement New feature or request

Comments

@avantgardnerio
Copy link
Contributor

avantgardnerio commented Aug 24, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Presently, show timezone does not work:

DataFusion CLI v11.0.0
❯ show time zone;
NotImplemented(“SHOW time.zone not implemented. Supported syntax: SHOW <TABLES>“)

Describe the solution you'd like

Instead, I would like:

show timezone;

To always return 'utc'.

set timezone 'utc';

Should succeed.

set timezone 'UTC+08`;

should return an error.

and

set timezone 'US/Mountain`;

should return the same error.

This should:

  1. make the work @waitingkuo is doing easier by ignoring non-UTC zones for now
  2. Stay technically compatible with ANSI SQL & postgres (as long as postgres is set to UTC)
  3. allow the option to implement timezones at a future date.

PS:

Do the same for select current_setting('TIMEZONE')

Describe alternatives you've considered

  • Having to violate ANSI SQL
  • Having to tackle timezones while implementing timestamp without timezone
@avantgardnerio avantgardnerio added the enhancement New feature or request label Aug 24, 2022
@avantgardnerio
Copy link
Contributor Author

@alamb
Copy link
Contributor

alamb commented Aug 31, 2022

For what it is worth, here is what postgres does (mostly what @avantgardnerio has proposed). Note there is an = in SET TIMEONE='';

psql (14.4)
Type "help" for help.

alamb=# show timezone
alamb-# ;
     TimeZone     
------------------
 America/New_York
(1 row)

alamb=# set timezone='UTC+08';
SET
alamb=# show timezone;
 TimeZone 
----------
 UTC+08
(1 row)

alamb=# set timezone='US/Mountain';
SET
alamb=# show timezone;
  TimeZone   
-------------
 US/Mountain
(1 row)

@alamb
Copy link
Contributor

alamb commented Aug 31, 2022

(the proposal in this ticket sounds good to me)

@avantgardnerio
Copy link
Contributor Author

Nice work @waitingkuo , thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants