SQL: T-SQL (SQL Server) - ALTER COLUMN, bracketed identifiers and USE/GO batches report parse_partial or parse_unusable (0.12.1)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 46/100
調査の方向性
Start by checking how the bundled SQL grammar is selected and how check_index_coverage reports parse errors; the payload identifies neither source files nor tests. Reproduce with the minimal cases in the issue, especially ALTER COLUMN without brackets and GO batches. Done means the listed T-SQL constructs parse and the expected table and column lineage is surfaced; consult #1755 for the PostgreSQL comparison.
索引モデルが issue の本文から書いたものです。
説明
Summary
Indexing a repository whose database/ folder holds Microsoft SQL Server (T-SQL) migration scripts: 11 of 14 .sql files are reported parse_partial and 3 are parse_unusable. The bundled .sql grammar appears to be the PostgreSQL family, so ordinary T-SQL constructs have no production and the files contribute almost nothing to the graph (a single Table node is all that survives).
This is not an encoding or file-size problem: the files are 20–950 bytes of plain ASCII/UTF-8 with no BOM, and skipped: [] (no ignore rules involved).
Environment
- codebase-memory-mcp 0.12.1, Windows 11, PowerShell 7
index_mode: full,auto_watch: true- Files: ASCII/UTF-8, no BOM, 20–950 bytes each
Minimal repro
One construct per file, each indexed in isolation in a throwaway project. Rows 00 and 10 are controls.
| # | File content | Result |
|---|---|---|
| 00 | CREATE TABLE sample (id INT NOT NULL PRIMARY KEY, url VARCHAR(200) NOT NULL); |
clean |
| 10 | CREATE TABLE sample (id SERIAL PRIMARY KEY, name TEXT); + grant select on sample to public; |
clean (PG parses fine) |
| 01 | SELECT 1 / GO / SELECT 2 |
parse_partial — line 2 only |
| 02 | SELECT * FROM [dbo].[sample]; |
parse_unusable |
| 11 | SELECT * FROM dbo.sample; |
clean |
| 03 | USE [app] / GO |
parse_unusable |
| 04 | CREATE DATABASE [app] / GO |
parse_partial — line 1 |
| 09 | DROP DATABASE [app] / GO |
parse_partial — line 1 |
| 05 | CREATE TABLE [dbo].[sample] with id INT NOT NULL IDENTITY PRIMARY KEY, url NVARCHAR(200) NOT NULL, createdUtc DATETIME2 NOT NULL, then GO |
parse_partial — line 3 (the IDENTITY column), line 7 (GO) |
| 07 | ALTER TABLE [dbo].[sample] newline ADD maxConnections INT |
parse_partial — line 1 |
| 13 | ALTER TABLE sample ADD maxConnections INT; |
clean |
| 06 | ALTER TABLE [dbo].[sample] ALTER COLUMN companyId INT NULL; |
parse_unusable |
| 12 | ALTER TABLE sample ALTER COLUMN companyId INT NULL; |
parse_unusable |
| 08 | ALTER TABLE [dbo].[sample] newline ADD CONSTRAINT ck_batch CHECK (NOT (method = 'GET' AND batchSize > 1)); |
parse_unusable |
In the real repository check_index_coverage returns parse_partial with ranges scattered across lines 1–8 of 8-line files, plus parse_unusable for whole files. Probe 09 (2 lines) is also flagged, so this is not a complexity, size or encoding threshold.
Key detail: GO and the brackets are not the whole story
Removing just the batch separators and the bracketed identifiers turns a realistic script completely clean:
USE app
CREATE TABLE dbo.sample
(
id INT NOT NULL IDENTITY PRIMARY KEY,
url NVARCHAR(200) NOT NULL
)
ALTER TABLE dbo.sample ADD maxConnections INT
...but ALTER COLUMN fails even without brackets — file 12 above is still parse_unusable. So bracket folding alone would not be sufficient.
Expected
T-SQL .sql files should parse without being flagged, ideally surfacing ALTER TABLE … ADD COLUMN and ALTER TABLE … ALTER COLUMN as column/table lineage the way the PostgreSQL path does (cf. #1755).
Suggested fix
- Pre-normalise before tree-sitter: split on
GOat line start and drop it; map[identifier]to"identifier". - Add a lenient production (or error-recovery rule) for
ALTER TABLE <table> ALTER COLUMN <col> <type> [NULL | NOT NULL]. - Longer term, a real T-SQL dialect — same shape as the request in #669 for PL/SQL.
Question
Is there any existing knob to select a SQL dialect? config list on 0.12.1 exposes only auto_index, auto_index_limit, auto_watch, doc_candidates, watcher_enabled, watch_non_git, ui-*, index_max_files, index_max_source_mb; the CBM_* environment variables contain nothing parser-, grammar- or encoding-related; and index_repository takes repo_path, mode, target_projects, name, persistence, doc_candidates — no dialect/language argument. If one exists, a pointer would be enough and this would be a docs issue rather than a parsing one.
Related: #669, #1598, #2572, #2934, #1755
- 主要言語
- C
- スター
- 45.8k
- フォーク
- 3.8k
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 108
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DeusData/codebase-memory-mcp のほかの issue
-
bug ux/behavior
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
DeusData/codebase-memory-mcp#3191 ·
メンテナーはふだん 1 日以内に返信
-
documentation enhancement parsing/quality ux/behavior
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
DeusData/codebase-memory-mcp#3131 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug editor/integration parsing/quality ux/behavior
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
DeusData/codebase-memory-mcp#3062 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug documentation editor/integration parsing/quality
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
DeusData/codebase-memory-mcp#3050 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
editor/integration parsing/quality
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DeusData/codebase-memory-mcp#2286 ·
メンテナーはふだん 1 日以内に返信
DeusData/codebase-memory-mcp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
メンテナーはふだん 1 日以内に返信
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the gameオープンgame: 010065A014024000 ios
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
seedds/nxnative#3714 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信