docs: update CLAUDE.md, skills, and add PostgreSQL grammar reference files#331
docs: update CLAUDE.md, skills, and add PostgreSQL grammar reference files#331
Conversation
Add internal/gram.y and internal/scan.l as local reference copies of PostgreSQL's parser sources. Update CLAUDE.md and the postgres_syntax skill to point to these local files instead of upstream GitHub URLs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sync documentation with actual codebase after reviewing all packages, test counts, and file listings. Key updates: add missing skills (Fix Bug, Refactor Pass), add column_privilege.go and rewrite.go references, update diff test counts (now 150+), document dump and include test suites, add PostgreSQL reference sources section, and correct dependency/version info. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diff test cases use diff.sql (not expected.sql) and also include plan.json, plan.sql, plan.txt. Fix all references in fix_bug and run_tests skills, and update stale test counts in run_tests to match current codebase (150+ tests). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR adds local copies of PostgreSQL parser reference files and updates all documentation to reflect the current codebase state. The changes improve developer workflow by making PostgreSQL grammar files ( Key changes:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: c3af7b6 |
There was a problem hiding this comment.
Pull request overview
Adds local PostgreSQL parser sources and updates internal developer docs/skills so contributors can reference upstream SQL grammar and keep testing/workflow docs aligned with the current repository structure.
Changes:
- Added local copies of PostgreSQL parser sources (
internal/gram.y,internal/scan.l) as reference material. - Updated
CLAUDE.mdto reflect current dependencies, package layout, and testdata conventions. - Updated Claude “skills” documentation (syntax reference, test-running, bug-fixing) to point at the correct local files and expected output filenames.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/scan.l |
Adds a local copy of PostgreSQL’s lexer rules for reference. |
internal/gram.y |
Adds a local copy of PostgreSQL’s grammar rules for reference. |
CLAUDE.md |
Refreshes repo/dependency/test references and documents the new local PostgreSQL reference sources. |
.claude/skills/run_tests/SKILL.md |
Updates testing docs to match current diff.sql + plan files convention. |
.claude/skills/postgres_syntax/SKILL.md |
Switches guidance to prefer the new local internal/gram.y / internal/scan.l copies. |
.claude/skills/fix_bug/SKILL.md |
Clarifies expected generated outputs for bug-repro test cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Like scan.l, this vendored PostgreSQL parser source doesn’t record which upstream version/commit it came from, and the repo doesn’t appear to include the PostgreSQL license/third‑party notice. Add clear provenance (version/tag/commit) and ensure the PostgreSQL license text is included somewhere in-repo and referenced from this file to avoid compliance ambiguity.
| * | |
| * VENDORED FROM POSTGRESQL | |
| * This file is a vendored copy of the PostgreSQL parser grammar. | |
| * Upstream project : PostgreSQL (https://www.postgresql.org/) | |
| * Upstream file : src/backend/parser/gram.y | |
| * Upstream version : <POSTGRESQL_VERSION_OR_TAG> | |
| * Upstream commit : <POSTGRESQL_COMMIT_SHA> | |
| * Please update the version/commit above if this file is re‑synced | |
| * from a different PostgreSQL release, and document any local | |
| * modifications below. | |
| * | |
| * LICENSE | |
| * This file is licensed under the PostgreSQL license, as provided | |
| * by the PostgreSQL Global Development Group. The full license | |
| * text is included in this repository in | |
| * THIRD_PARTY_LICENSES/PostgreSQL.txt (or an equivalent | |
| * third‑party notice file referenced by the project’s main | |
| * LICENSE/NOTICE documentation). | |
| * |
| **PostgreSQL Reference Sources** (`internal/`): | ||
|
|
||
| - `gram.y` - Local copy of PostgreSQL's Yacc/Bison grammar for SQL syntax reference | ||
| - `scan.l` - Local copy of PostgreSQL's Flex lexer for tokenization reference |
There was a problem hiding this comment.
Since the repo now includes local copies of upstream PostgreSQL parser sources, it would be helpful to document which PostgreSQL release/commit these correspond to (and where the license/third‑party notice lives). Without that, it’s easy for these reference files to silently drift from the target PostgreSQL version you support.
| - `scan.l` - Local copy of PostgreSQL's Flex lexer for tokenization reference | |
| - `scan.l` - Local copy of PostgreSQL's Flex lexer for tokenization reference | |
| - These files are currently synced to PostgreSQL release 16.4 (tag `REL_16_4`); update this note when bumping to a new upstream version or commit. | |
| - License and third-party notices for these PostgreSQL sources are documented in the repository under `third_party/postgresql/` (for example, `third_party/postgresql/LICENSE` and `third_party/postgresql/NOTICE`). |
| * | ||
| * IDENTIFICATION | ||
| * src/backend/parser/scan.l | ||
| * |
There was a problem hiding this comment.
These PostgreSQL source files are being vendored into the repo, but there’s no explicit provenance (PostgreSQL version/tag/commit) or accompanying license/third‑party notice. Please add a short header note stating the exact upstream version/commit and include the PostgreSQL license text (e.g., in a THIRD_PARTY_NOTICES/ directory or a dedicated license file referenced from here) to keep licensing/compliance clear.
| * | |
| * | |
| * Vendoring note: | |
| * This file is derived from the upstream PostgreSQL source file | |
| * src/backend/parser/scan.l at version/commit | |
| * <POSTGRESQL_UPSTREAM_VERSION_OR_COMMIT>. | |
| * If this file is updated from a different upstream revision, please | |
| * update the version/commit identifier above accordingly. | |
| * | |
| * PostgreSQL license: | |
| * | |
| * Permission to use, copy, modify, and distribute this software and its | |
| * documentation for any purpose, without fee, and without a written | |
| * agreement is hereby granted, provided that the above copyright notice | |
| * and this paragraph and the following two paragraphs appear in all | |
| * copies. | |
| * | |
| * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY | |
| * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, | |
| * INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS | |
| * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF | |
| * THE POSSIBILITY OF SUCH DAMAGE. | |
| * | |
| * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, | |
| * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE | |
| * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF | |
| * CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, | |
| * ENHANCEMENTS, OR MODIFICATIONS. | |
| * |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c129b23 to
b101c93
Compare
Summary
gram.yandscan.lparser sources tointernal/for quick reference when implementing featuresCLAUDE.mdto reflect current codebase stateTest plan
🤖 Generated with Claude Code