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

builtins: make date_trunc(week, timestamp[tz]) truncate to Monday #42622

Merged
merged 1 commit into from
Nov 20, 2019

Conversation

otan
Copy link
Contributor

@otan otan commented Nov 20, 2019

Resolves #42612

Release note (sql change): The date_trunc function, when used with
week, previously truncated to Sunday. This PR will make it follow
postgres more closely by truncating to Monday instead.

@otan otan requested review from rafiss and a team November 20, 2019 21:10
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Release note (sql change): The `date_trunc` function, when used with
`week`, previously truncated to Sunday. This PR will make it follow
postgres more closely by truncating to Monday instead.
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the extremely fast turnaround! lgtm

Reviewed 3 of 3 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@otan
Copy link
Contributor Author

otan commented Nov 20, 2019

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 20, 2019

Build failed

@otan
Copy link
Contributor Author

otan commented Nov 20, 2019

bors r+

flake looks unrelated

@craig
Copy link
Contributor

craig bot commented Nov 20, 2019

Build failed (retrying...)

craig bot pushed a commit that referenced this pull request Nov 20, 2019
42613: sql: add cast support to TimeTZ r=otan a=otan

Refs: #26097

Added the various casts supported by postgres for `timetz`:

```
otan=# select
  castcontext,
  f.typname as "from",
  t.typname as to
from pg_cast
join pg_type as f ON (f.typelem = castsource)
join pg_type as t on (t.typelem=casttarget)
where
  castsource = 'timetz'::regtype or
  casttarget = 'timetz'::regtype;
 castcontext |     from     |   to
-------------+--------------+---------
 i           | _time        | _timetz
 a           | _timestamptz | _timetz
 i           | _timetz      | _timetz
 a           | _timetz      | _time
(4 rows)
```

No release not required as this will be combined with a fully fleshed
note for TimeTZ.

Release note: None

42622: builtins: make date_trunc(week, timestamp[tz]) truncate to Monday r=otan a=otan

Resolves #42612

Release note (sql change): The `date_trunc` function, when used with
`week`, previously truncated to Sunday. This PR will make it follow
postgres more closely by truncating to Monday instead.

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Nov 20, 2019

Build succeeded

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

Successfully merging this pull request may close these issues.

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