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

Support to_char on timestamptz #7687

Closed
neverchanje opened this issue Feb 3, 2023 · 1 comment · Fixed by #11778
Closed

Support to_char on timestamptz #7687

neverchanje opened this issue Feb 3, 2023 · 1 comment · Fixed by #11778
Assignees
Milestone

Comments

@neverchanje
Copy link
Contributor

neverchanje commented Feb 3, 2023

Is your feature request related to a problem? Please describe.

select to_char(now(), 'YYYY-MM-DD HH24:MI:SS.MS TZ');

This query fails with the following error:

ERROR:  QueryError: Feature is not yet implemented: ToChar[Timestamptz, unknown]
Tracking issue: https://github.com/risingwavelabs/risingwave/issues/112

to_char ( timestamp, text ) → text is supported:

dev=> select to_char(now()::timestamp, 'YYYY-MM-DD HH24:MI:SS.MS TZ');
NOTICE:  Your session timezone is UTC. It was used in the interpretation of timestamps and dates in your query. If this is unintended, change your timezone to match that of your data's with `set timezone = [timezone]` or rewrite your query with an explicit timezone conversion, e.g. with `AT TIME ZONE`.

          to_char
---------------------------
 2023-02-06 05:04:17.MS TZ
(1 row)

to_char ( timestamp with time zone, text ) → text is not.

Describe the solution you'd like

Converts time stamp to string according to the given format.

  • to_char(timestamptz '2002-04-20 17:31:12.66', 'HH12:MI:SS') → 05:31:12

Describe alternatives you've considered

No response

Additional context

Sqllogictest:


query T
SELECT to_char(TIMESTAMPTZ '1997-02-03 11:12:59.9', 'YYYY-MM-DD HH24:MI:SS.MS TZ')
----
1997-02-03 11:12:59.900 UTC

query T
SELECT to_char(TIMESTAMPTZ '1997-02-03 11:12:59.7777', 'YYYY-MM-DD HH24:MI:SS.MS TZ')
----
1997-02-03 11:12:59.777 UTC
@github-actions github-actions bot added this to the release-0.1.17 milestone Feb 3, 2023
@neverchanje neverchanje changed the title Support conversion from timestamp to text: to_char(timestamp, text) Support conversion from timestamp to text: to_char(timestamptz, text) Feb 15, 2023
@TennyZhuang
Copy link
Contributor

#7334

@TennyZhuang TennyZhuang modified the milestones: release-1.0, release-1.1 Jul 14, 2023
@fuyufjh fuyufjh assigned xiangjinwu and unassigned TennyZhuang Aug 8, 2023
@fuyufjh fuyufjh modified the milestones: release-1.1, release-1.2 Aug 8, 2023
@xiangjinwu xiangjinwu changed the title Support conversion from timestamp to text: to_char(timestamptz, text) Support to_char on timestamptz Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants