Repository navigation
Description
graphify 0.9.39, Windows, Python 3.14.2, graphify . --code-only (AST only, no backend).
A CREATE PROCEDURE or CREATE FUNCTION whose name is bracket-quoted produces no node at all. Not a mangled node, not a partial one — the callable is simply absent from graph.json, and the build exits 0.
Bracket quoting is what SSMS emits by default when scripting a database, so for T-SQL scripted out of SQL Server this is the normal case rather than an edge case.
Repro
schema.sql, bracketed:
CREATE TABLE dbo.Customer (Id INT NOT NULL PRIMARY KEY);
GO
CREATE PROCEDURE [dbo].[GetCustomer] @Id INT
AS
BEGIN
SELECT Id FROM dbo.Customer WHERE Id = @Id;
END
GOgraphify . --code-only
Actual — 2 nodes: schema.sql, dbo.Customer. No GetCustomer.
Expected — a node for the procedure, as the bare-name form produces.
Change only the name to dbo.GetCustomer and it appears:
3 nodes : schema.sql, dbo.Customer, dbo.GetCustomer()
Isolation
Each row differs from its neighbours in one thing only:
| input | result |
|---|---|
CREATE PROCEDURE [dbo].[GetCustomer] |
absent |
CREATE PROCEDURE [GetCustomer] (no schema) |
absent |
CREATE PROCEDURE dbo.GetCustomer |
present |
bare name, body fully bracketed (FROM [dbo].[Customer] WHERE [Id] = @Id) |
present |
bracketed name, no GO separators anywhere |
absent |
CREATE FUNCTION [dbo].[CustomerName] |
absent |
CREATE TABLE [dbo].[Customer] |
present (label dbo].[Customer — that is #2712) |
CREATE VIEW [dbo].[CustomerList] |
present (label mangled the same way) |
So it is the bracket quoting on the callable's own name, and nothing else:
- not
GO— removing every batch separator changes nothing; - not brackets elsewhere — a bare name with a fully bracketed body extracts fine;
- not the
].[sequence that causes the T-SQL: bracket-quoted identifiers keep their brackets — [dbo].[Customer] becomes the labeldbo].[Customer, so no lookup by real name matches #2712 label mangling — a schema-less[GetCustomer]produces no].[at all, gives a clean label everywhere else in the file, and still yields no node; - not shared with tables and views — those survive bracketing, mangled labels aside.
Relationship to the existing SQL issues
Distinct from both:
- T-SQL: bracket-quoted identifiers keep their brackets — [dbo].[Customer] becomes the label
dbo].[Customer, so no lookup by real name matches #2712 is label mangling. Bracketed tables and views are present with a bad label; here the node does not exist. And T-SQL: bracket-quoted identifiers keep their brackets — [dbo].[Customer] becomes the labeldbo].[Customer, so no lookup by real name matches #2712 needs the qualified form, while this reproduces with[Name]alone. - T-SQL: a bracketed FOREIGN KEY can drop the child table entirely and emit a self-referencing edge tagged EXTRACTED #2713 is a bracketed foreign key dropping a child table. Different declaration, different trigger, and it does not predict that a bracketed
CREATE PROCEDUREyields nothing.
Why it is worth prioritising
Measured on a ~10 MB SSMS-scripted T-SQL schema dump (~235 000 lines), built twice — verbatim, and again with bracket quoting stripped from plain identifiers only:
| verbatim | unbracketed | |
|---|---|---|
| nodes | 132 | 1 008 |
| procedures present | 0 / 845 | 845 / 845 |
| functions present | 5 / 16 | 16 / 16 |
| tables present | 45 / 431 | 57 / 431 |
| views present | 32 / 84 | 41 / 84 |
Two smaller dumps behave the same way (33 → 107 and 22 → 61 nodes, both 0 procedures → all procedures).
Being straight about one row: the 5 / 16 functions in the verbatim column are not explained by this issue — the minimal repro drops a bracketed function outright, so whatever lets those five through is something I did not isolate. Everything else in the table matches the repro.
The failure is silent — no warning, exit 0, a plausible node count and a healthy EXTRACTED percentage — so a graph of a stored-procedure-heavy database looks complete while containing none of its procedures. There is also no in-repo workaround: stripping brackets from committed SQL to satisfy the extractor would corrupt the source.
Note that the tables/views columns above improve only modestly, so this defect does not explain the low table yield on large dumps — that looks like something separate and is not what this issue is about.
Activity
YNFM commentedon Aug 13, 2026
Correction to my own report: there is a second, independent trigger for the same symptom, and my repro missed it.
Running this against a real T-SQL repository — 94
.sql, 23 procedures, all absent from the graph — I expected bracket quoting to account for all 23. It does not. Seven of those procedures are declared with bare names and are still missing. What they share with the other sixteen isCREATE OR ALTER.Repro
Same shape as the original, four variants, one difference each:
CREATE PROCEDURE dbo.GetCustomerCREATE OR ALTER PROCEDURE dbo.GetCustomerCREATE OR ALTER PROCEDURE [dbo].[GetCustomer]CREATE OR ALTER FUNCTION dbo.CustomerName→ 2 nodes:
schema.sql,dbo.Customer. Drop theOR ALTERanddbo.GetCustomer()appears.So
OR ALTERbreaksPROCEDUREbut notFUNCTION, and it is independent of the bracket quoting in the original report — either one alone is sufficient to lose the node, which is why a corpus can lose 100% of its procedures to what looks like one cause.CREATE OR ALTERis the idiomatic form for a re-runnable migration script, so in practice this may be the more common of the two triggers.Why it matters for the fix
Fixing bracket handling alone would have left that repository at 0 of 23 procedures — the same number it has today — because both triggers are present. Anyone verifying a fix against real SSMS-scripted or migration-style T-SQL needs both cases covered or the result will look unchanged.
Happy to split this into its own issue if you would rather track it separately — it is the same symptom and the same declaration class, so I have kept it here rather than fragmenting.
Add regression tests for bracketed CREATE PROCEDURE/FUNCTION names
Recover a CREATE VIEW/TABLE swallowed by a preceding broken routine
Add regression tests for bracketed CREATE PROCEDURE/FUNCTION names
Recover a CREATE VIEW/TABLE swallowed by a preceding broken routine
Add regression tests for bracketed CREATE PROCEDURE/FUNCTION names
Recover a CREATE VIEW/TABLE swallowed by a preceding broken routine