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

sql: DATE_TRUNC('week', <value>) truncates to midnight Sunday rather than Monday #42612

Closed
rafiss opened this issue Nov 20, 2019 · 0 comments · Fixed by #42622
Closed

sql: DATE_TRUNC('week', <value>) truncates to midnight Sunday rather than Monday #42612

rafiss opened this issue Nov 20, 2019 · 0 comments · Fixed by #42622
Assignees
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL

Comments

@rafiss
Copy link
Collaborator

rafiss commented Nov 20, 2019

DATE_TRUNC('week', <value>) truncates to midnight Sunday on cockroachdb but midnight Monday on PostgreSQL.

This was discovered while testing with Django: cockroachdb/django-cockroachdb#92

PostgreSQL:

> SELECT DATE_TRUNC('week', '2019-11-13'::timestamp);
"2019-11-11 00:00:00"

cockroach:

> SELECT DATE_TRUNC('week', '2019-11-13'::timestamptz);
         date_trunc          
+---------------------------+
  2019-11-10 00:00:00+00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants