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: fix sub-second EXTRACT behaves differently from postgres #41069

Merged
merged 1 commit into from
Oct 8, 2019

Conversation

hueypark
Copy link
Contributor

Fixes #40683

Release note (sql change): sub-second EXTRACT behaves same as postgres.

Release justification: low-risk bugfix.

Release note (sql change): sub-second EXTRACT behaves same as postgres.

Release justification: low-risk bugfix.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@maddyblue maddyblue left a comment

Choose a reason for hiding this comment

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

Code LGTM. @jordanlewis will make a decision about whether we will ship this in 19.2

@knz
Copy link
Contributor

knz commented Sep 25, 2019

IMHO this is a bug fix, not "sql change", and is even candidate to back port in 19.1.

@maddyblue
Copy link
Contributor

It's a bug fix only in that we differ from the spec: it was acting exactly as we intended otherwise. Anyone relying on EXTRACT will see a massive behavior change that will break their app. For that reason I think we should definitely not backport it to 19.1. 19.2 is a possibility because we haven't shipped that yet and so we allow some behavior changes. I'm still lightly on the "it should wait for 20.1" side myself.

@maddyblue
Copy link
Contributor

As another example, our int / int operator differs from postgres. If we changed that today to exactly match postgres it seems unlikely we would backport that to 19.1, and it's even weird to consider shipping that in 19.2 at this point in the release cycle.

@maddyblue
Copy link
Contributor

We've decided to wait for 20.1 to ship this. I'll merge this as soon as the master branch is open, which we expect to be in a week.

@hueypark
Copy link
Contributor Author

Thanks for the careful review!

@maddyblue
Copy link
Contributor

bors r+

craig bot pushed a commit that referenced this pull request Oct 8, 2019
41069: sql: fix sub-second EXTRACT behaves differently from postgres r=mjibson a=hueypark

Fixes #40683

Release note (sql change): sub-second EXTRACT behaves same as postgres.

Release justification: low-risk bugfix.

Co-authored-by: Jaewan Park <jaewan.huey.park@gmail.com>
@craig
Copy link
Contributor

craig bot commented Oct 8, 2019

Build succeeded

@craig craig bot merged commit 45dc856 into cockroachdb:master Oct 8, 2019
@jseldess
Copy link
Contributor

@mjibson, @knz, shouldn't this be listed as a backward-incompatible change, given what Matt says above?

Anyone relying on EXTRACT will see a massive behavior change that will break their app.

@knz
Copy link
Contributor

knz commented Nov 17, 2019

yes I would agree with that (but the phrasing of the change should still emphasize that the previous crdb behavior was unintended — i.e. we consider it as a bug)

@jseldess
Copy link
Contributor

@mjibson, can you please write a sentence or two about how "anyone relying on EXTRACT will see a massive behavior change"? If we call this out as backward-incompatible, we need to say more.

@maddyblue
Copy link
Contributor

EXTRACT with sub-second arguments (millisecond, microsecond) is now Postgres-compatible, and will return the total number of seconds in addition to sub seconds. Anyone who was previously relying on EXTRACT to return only sub-second data will need to adjust their applications.

Is that good?

@jseldess
Copy link
Contributor

Yep. Thanks, Matt.

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.

Sub-second EXTRACT behaves differently from postgres
5 participants