Skip to content

[R2 SQL] Add support for UNION, INTERSECT, EXCEPT, and SELECT DISTINCT#31252

Open
sejoker wants to merge 1 commit into
productionfrom
r2-sql/union-changelog
Open

[R2 SQL] Add support for UNION, INTERSECT, EXCEPT, and SELECT DISTINCT#31252
sejoker wants to merge 1 commit into
productionfrom
r2-sql/union-changelog

Conversation

@sejoker
Copy link
Copy Markdown
Contributor

@sejoker sejoker commented Jun 5, 2026

Summary

Add support for UNION, INTERSECT, EXCEPT, and SELECT DISTINCT in R2 SQL.

Documentation checklist

@cloudflare-docs-bot
Copy link
Copy Markdown
Contributor

cloudflare-docs-bot Bot commented Jun 5, 2026

Review

⚠️ 5 warnings and 1 suggestion found in commit c5b23f3.

Warnings (5)
File Issue
r2-sql/sql-reference/index.mdx line 97 Escape angle brackets in MDX prose — Line adds unescaped > in prose: WHERE total_amount > 1000 Fix: Replace > with > or wrap the text in backticks.
r2-sql/sql-reference/index.mdx line 627 Escape angle brackets in MDX prose — Line adds unescaped > in prose: SELECT zone_id FROM my_namespace.http_requests WHERE risk_score > 0.8 Fix: Replace > with > or wrap the text in backticks.
changelog/r2-sql/2026-06-05-union-intersect-except-select-distinct.mdx line 24 Escape angle brackets in MDX prose — Line adds unescaped > in prose: SELECT zone_id FROM my_namespace.http_requests WHERE risk_score > 0.8 Fix: Replace > with > or wrap the text in backticks.
changelog/r2-sql/2026-06-05-union-intersect-except-select-distinct.mdx line 33 Escape angle brackets in MDX prose — Line adds unescaped > in prose: HAVING COUNT(\*) > 10000 Fix: Replace > with > or wrap the text in backticks.
changelog/r2-sql/2026-06-05-union-intersect-except-select-distinct.mdx line 50 Escape angle brackets in MDX prose — Line adds unescaped > in prose: WHERE total_amount > 1000 Fix: Replace > with > or wrap the text in backticks.
Suggestions (1)
File Issue
r2-sql/sql-reference/index.mdx line 90 Heading uses title case### SELECT DISTINCT capitalizes multiple non-proper-noun words Fix: Use sentence case: ### Select distinct
Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/product-owners
/src/content/docs/r2-sql/ @Marcinthecloud, @netgusto, @sesteves, @sejoker, @laplab, @jonesphillip, @elithrar, @jonathanc-n, @cloudflare/product-owners

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

CI run failed: build logs

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

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

The documentation changes are accurate and well-structured. One issue needs attention before merge:

MEDIUM — The PR description is empty. The Summary and Screenshots sections in the body template are blank. Add a brief description of what changed and why.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Jun 5, 2026

I reviewed PR #31252 and posted a review comment on the PR.

Summary of changes

The PR adds documentation for four newly supported R2 SQL features across three files:

  • Changelog entry (src/content/changelog/r2-sql/2026-06-05-union-intersect-except-select-distinct.mdx) — New entry explaining UNION, INTERSECT, EXCEPT, and SELECT DISTINCT with practical examples.
  • Limitations page (src/content/docs/r2-sql/reference/limitations-best-practices.mdx) — Updates the quick-reference table to mark SELECT DISTINCT and UNION / INTERSECT / EXCEPT as supported.
  • SQL reference (src/content/docs/r2-sql/sql-reference/index.mdx) — Adds a SELECT DISTINCT section and a comprehensive "Set operations" section with syntax, descriptions, and examples.

Issues flagged

MEDIUM — The PR description is empty. The body contains only unchecked template sections (Summary, Screenshots) with no actual context about the change. I suggested adding a brief description of what changed and why before merging.

Notes

  • The content is technically accurate and follows the documentation style guide.
  • Links are properly formatted with root-relative paths and trailing slashes.
  • Code examples use correct lowercase language identifiers (sql).
  • Frontmatter is valid across all changed files.

One minor inconsistency I noted: the top-level query syntax block in the SQL reference still shows SELECT column_list | expression | aggregation_function without [DISTINCT], while a dedicated section below documents the new DISTINCT support. This is a very low-priority polish item that can be addressed in a follow-up if desired.

github run

@sejoker
Copy link
Copy Markdown
Contributor Author

sejoker commented Jun 5, 2026

The 5 angle bracket warnings are false positives - all the > characters are inside SQL code blocks ( ``sql ... ``` `),
which don't require escaping. Code blocks preserve their content literally and aren't parsed as MDX/JSX.

@ask-bonk ask-bonk Bot added documentation Documentation edits changelog Adds or updates changelog entries/pages. labels Jun 5, 2026
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

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

Two headings use title case instead of sentence case. Inline suggestions posted.

There is a failing CI run that should be investigated before merging. The bot's angle-bracket warnings appear to be false positives (all > occurrences are inside fenced sql code blocks), so the actual CI error is likely unrelated.

SELECT zone_id FROM my_namespace.compaction_history
```

## SELECT DISTINCT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use sentence case per the style guide:

Suggested change
## SELECT DISTINCT
## Select distinct

- **Column alias**: `column_name AS alias`
- **Expressions**: arithmetic, function calls, CASE expressions, and casts

### SELECT DISTINCT
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use sentence case per the style guide:

Suggested change
### SELECT DISTINCT
### Select distinct

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Jun 5, 2026

Review completed for PR #31252

Labels applied: product:r2-sql, documentation, changelog

What the PR changes

  • Adds a new changelog entry documenting R2 SQL support for UNION, INTERSECT, EXCEPT, and SELECT DISTINCT
  • Updates the limitations quick-reference table to mark SELECT DISTINCT and set operations as supported, and removes them from the unsupported features table
  • Adds a SELECT DISTINCT section and a comprehensive "Set operations" section to the SQL reference page with syntax, descriptions, and examples

Issues flagged

  • MEDIUM — Two headings use title case instead of sentence case:

    • src/content/changelog/r2-sql/2026-06-05-union-intersect-except-select-distinct.mdx line 43: ## SELECT DISTINCT## Select distinct
    • src/content/docs/r2-sql/sql-reference/index.mdx line 90: ### SELECT DISTINCT### Select distinct
    • Posted inline suggestions for both.
  • CI failure needs investigation — The PR has a failing CI run. The cloudflare-docs-bot flagged 5 unescaped angle-bracket warnings, but all of those > characters appear inside fenced sql code blocks and should not break the MDX build. The actual CI error is likely unrelated to those warnings and should be checked before merging.

Everything else checks out: Frontmatter is valid, links are root-relative with trailing slashes, code blocks use lowercase sql, and the content is accurate and well-structured.

github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog Adds or updates changelog entries/pages. documentation Documentation edits product:changelog product:r2-sql size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants