-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
release-2.1: assorted CTE fixes #31051
Merged
knz
merged 6 commits into
cockroachdb:release-2.1
from
knz:backport2.1-30858-30939-31003-31004-31007
Oct 11, 2018
Merged
release-2.1: assorted CTE fixes #31051
knz
merged 6 commits into
cockroachdb:release-2.1
from
knz:backport2.1-30858-30939-31003-31004-31007
Oct 11, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces Cockroach-style single-use CTEs to the optimizer. Such CTEs cannot be referenced more than once in a query. Release note: None
These two checks are now exhaustive, meaning anything missing from them going forward is an error. Release note: None
The SQL standard (and pg) specifies that CTEs containing mutations are executed no matter how / how many times they are used in the remainder of the query. Meanwhile the heuristic planner + execution machinery is currently unable to force the execution of CTEs containing mutations if they are not otherwise used in the rest of the query. However meanwhile they are also accepted silently -- i.e. CockroachDB silently fails to do what the semantics require. This patch changes the behavior to instead report an error "feature not supported". Release note (bug fix): CockroachDB now reports an unimplemented error when a common table expression containing INSERT/UPDATE/UPSERT/DELETE is not otherwise used in the remainder of the query.
Prior to this patch, CockroachDB silently ignored WITH clauses within parentheses, so that the following SQL would return incorrect results: ``` CREATE TABLE t(x INT); (WITH t AS (SELECT 1) TABLE t); ``` (note: `WITH ...` *without* parentheses did work fine) This patch fixes this particular issue, and causes CockroachDB to issue an "unimplemented error" in other cases not supported yet, for example when there are multiple nested WITH clauses within parentheses. Release note (bug fix): CockroachDB does not silently ignore WITH clauses within parentheses any more.
Release note: None
Release note (sql change): CockroachDB now supports CTEs inside views.
First 5 commits LGTM. I'll let someone review the last one who reviewed the original PR. |
jordanlewis
approved these changes
Oct 10, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport:
Please see individual PRs for details.
/cc @cockroachdb/release