Skip to content

Parse floating column declarations with a precision argument - #7

Merged
laodouya merged 4 commits into
masterfrom
fix/float-column-precision
Nov 6, 2026
Merged

laodouya merged 4 commits into
masterfrom
fix/float-column-precision

Conversation

@laodouya

@laodouya laodouya commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

FLOAT(24), DOUBLE(24), and REAL(24) fall back to partial DDL without a column specification. Following defaults are consequently absent from CovenantSQL's column-default checks, as the new AST regression demonstrates.

Adapt the single-precision production from Vitess 7314463f4658 and regenerate sql.go. Consensus impact: the fuller DDL AST exposes CURRENT_TIMESTAMP defaults to the sanitizer and tightens consumer acceptance. Acceptance also widens: declarations with a default such as 'a;b' now remain one statement instead of failing at the embedded semicolon. Master can also rewrite accepted DDL by splitting inside a default string and letting the consumer rejoin with ; (for example, 'a;select 1 --' is stored as 'a; select 1 --'); this branch keeps the string intact. No MySQL type aliases are added.

Testing

Linux/amd64, Docker Go 1.27.3, 4 CPUs. The precision and semicolon-default regressions fail for all three declarations on master and pass on this branch. After merging master, build and vet pass, and all 87 tests pass. CovenantSQL develop and a scratch branch replacement pass the build and xenomint tests. Commands run in their respective repositories:

GO111MODULE=off go build ./...
GO111MODULE=off go vet ./...
GO111MODULE=off go test -json -count=1 ./...
GO111MODULE=off go test -count=1 -run '^TestFloatColumnPrecision' .
GO111MODULE=on go run golang.org/x/tools/cmd/[email protected] -o sql.go sql.y
gofmt -w sql.go
go build -tags 'linux sqlite_omit_load_extension sqlite_omit_localtime' ./...
go test -json -count=1 -tags 'linux sqlite_omit_load_extension sqlite_omit_localtime' ./xenomint/...

Adapt the single-precision length rule from Vitess 7314463f4658.
FLOAT(24), DOUBLE(24), and REAL(24) previously fell back to partial DDL
without a TableSpec, hiding following defaults from consumer checks.
Preserve the SQLite-compatible type spellings and two-number forms.

This changes the DDL AST and exposes CURRENT_TIMESTAMP defaults to the
CovenantSQL sanitizer, intentionally tightening consensus acceptance.
Complete parsing of a single-precision column declaration also keeps
semicolons inside default strings within the statement. Cover FLOAT,
DOUBLE, and REAL through ParseMultiple, preserving the original query
and string value. This acceptance expansion accompanies the stricter
stateful-default checks documented for the grammar change.
Keep INSERT comment handling and the single-argument floating precision
production together. Regenerate sql.go with the pinned goyacc revision.
@laodouya
laodouya merged commit daddab8 into master Nov 6, 2026
2 checks passed
@laodouya
laodouya deleted the fix/float-column-precision branch November 6, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant