You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Schema declarations and inserts enforce relation naming inconsistently, and the result is a relation that can be written but never read.
Repro (verified on a live server, 2026-08-19)
.kg create underscore_repro
.kg use underscore_repro
+__dunder(name: string) -- rejected: 'Relation name __dunder must start with lowercase letter'
+__dunder[("a",)] -- ACCEPTED: 'Inserted 1 fact(s)' (auto-created, untyped: col0 any)
?__dunder(N) -- fails: 'Cannot insert variable N - use constants only'
The insert path auto-creates the relation without running the name validation that the schema-declaration path enforces, and the query parser then cannot address the relation at all (the error message is also misleading - a query is reported as an insert problem).
Impact
This made the Python SDK's migration recorder silently broken in production use: it recorded applied migrations into inputlayer_migrations (write succeeded), but status/revert could never read them back, so showmigrations always showed unapplied and apply re-ran migrations every time. Fixed on the SDK side by renaming the relation (PR #101), but the engine should refuse the insert exactly like it refuses the declaration.
Suggested fix
Run the same relation-name validation on the insert auto-create path as on schema declarations, and fix the query error message for unaddressable relation names.
Related: the parse error for the invalid schema declaration is returned as an informational message rather than an error frame, so SDK clients cannot detect it programmatically - worth folding into the same pass.
Still valid at 6251065. Fixed by wp-name-validation (storage-layer grammar [a-z][a-z0-9_]*, also rejecting ':' in KG names, which currently corrupts shard ownership across tenants) and wp-parser-strings (the ? branch catches every prefix and returns a name error).
Activity
jsam commentedon Oct 1, 2026
Still valid at 6251065. Fixed by wp-name-validation (storage-layer grammar [a-z][a-z0-9_]*, also rejecting ':' in KG names, which currently corrupts shard ownership across tenants) and wp-parser-strings (the
?branch catches every prefix and returns a name error).fix(storage): enforce one KG and relation name grammar
fix(storage): enforce one KG and relation name grammar (#152)