Skip to content

Add SQL grammar documentation for PenguinDB#18

Open
rahulc0dy wants to merge 8 commits into
mainfrom
docs/sql-grammar
Open

Add SQL grammar documentation for PenguinDB#18
rahulc0dy wants to merge 8 commits into
mainfrom
docs/sql-grammar

Conversation

@rahulc0dy

@rahulc0dy rahulc0dy commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Issue Reference

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive PenguinDB SQL grammar (BNF + readable EBNF) covering full statement syntax for DDL/DML, expression/operator precedence, function/call and join forms, data types, lexical rules and case-sensitivity, literals and string-escaping, WHERE boolean logic with precedence/grouping, and notes on constraint ordering and special-case behaviors.

@rahulc0dy rahulc0dy requested a review from theMr17 June 4, 2026 06:05
@rahulc0dy rahulc0dy added the sql gateway Components for parsing SQL and translating queries into native Key-Value storage operations. label Jun 4, 2026
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)

Walkthrough

Adds docs/grammar.md, a complete PenguinDB SQL grammar in BNF and EBNF, including lexical rules, DDL for databases/tables, DML statements, expression precedence, data types, token definitions, and reference notes.

Changes

SQL Grammar Documentation

Layer / File(s) Summary
Document header and lexical rules
docs/grammar.md
Document header and global lexical rule: keywords and unquoted identifiers are case-insensitive; single-quoted strings preserve casing.
BNF grammar (statements, DDL, DML, expressions)
docs/grammar.md
Full BNF covering program/statement structure; CREATE/ALTER/DROP DATABASE/TABLE; column constraints and ordering; SELECT/INSERT/UPDATE/DELETE; WHERE boolean precedence; expression/operator precedence.
EBNF restatement
docs/grammar.md
Readable EBNF restatement of the same grammar covering statements, clauses, expressions, data types, identifiers, and literals.
Reference notes
docs/grammar.md
Notes summarizing semicolon-terminated scripts, identifier/literal character rules, numeric/string literal specifics (including '' escaping), select-expression ambiguity guidance, and canonical constraint ordering.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot changed the title @coderabbitai Add SQL grammar documentation for PenguinDB Jun 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cef01870-a83e-48d8-9045-11b15094c49a

📥 Commits

Reviewing files that changed from the base of the PR and between 9601155 and ed20d93.

📒 Files selected for processing (3)
  • docs/grammar.md
  • docs/sql-grammar/grammar.bnf
  • docs/sql-grammar/grammar.ebnf

Comment thread docs/sql-grammar/grammar.bnf Outdated
Comment thread docs/sql-grammar/grammar.bnf Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 4, 2026
@rahulc0dy rahulc0dy requested a review from Souvik606 June 4, 2026 06:27
Comment thread docs/grammar.md Outdated
Comment thread docs/grammar.md Outdated
Comment thread docs/grammar.md Outdated
Comment thread docs/grammar.md
Comment thread docs/grammar.md Outdated
Comment thread docs/grammar.md Outdated

@Souvik606 Souvik606 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please check and resolve these changes

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 5, 2026
@rahulc0dy rahulc0dy requested a review from Souvik606 June 5, 2026 05:10
Comment thread docs/grammar.md Outdated
Comment thread docs/grammar.md Outdated

@Souvik606 Souvik606 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please fix these sql specific patterns

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 5, 2026
@rahulc0dy

Copy link
Copy Markdown
Contributor Author

Following additional rules are to be implemented:

  1. Strings to accept all non single quote characters
  2. Add IF EXISTS / IF NOT EXISTS
  3. Add ORDER BY clause
  4. Add LIKE predicate
  5. Add IS NULL / IS NOT NULL predicate
  6. Add IN predicate
  7. Add BETWEEN predicate
  8. NullConstraint → support both NULL and NOT NULL
  9. Add unary + support
  10. Add DISTINCT in SELECT
  11. GROUP BY / HAVING
  12. Add aggregate functions
  13. Add JOIN syntax
  14. Add qualified column references (table.column)
  15. Add OFFSET

@Souvik606 Souvik606 self-requested a review June 5, 2026 13:44
Souvik606
Souvik606 previously approved these changes Jun 5, 2026
@rahulc0dy rahulc0dy dismissed stale reviews from Souvik606 and coderabbitai[bot] via 1663c12 June 6, 2026 03:49
@rahulc0dy rahulc0dy requested a review from Souvik606 June 6, 2026 03:51
@rahulc0dy rahulc0dy enabled auto-merge (squash) June 6, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql gateway Components for parsing SQL and translating queries into native Key-Value storage operations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants