feat(server): allow readonly D1 pragma statements#298
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
onequery-landing | 4286ceb | Commit Preview URL Branch Preview URL |
Jun 26 2026, 07:20 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-Line Summary
Allow Cloudflare D1 metadata PRAGMA statements that are safe under read-only SQL validation.
User-Facing Changes
PRAGMA table_list,PRAGMA table_info("events"),PRAGMA index_list("events"),PRAGMA foreign_key_check, andPRAGMA quick_check.PRAGMA foreign_keys=off,PRAGMA foreign_keys,PRAGMA case_sensitive_like, andPRAGMA optimizeare still rejected withOnly read-only PRAGMA statements are allowed.Why This Changed
D1 supports PRAGMA statements for schema and index inspection, but the SQL validator treated every
pragmaAST node as side-effecting. That blocked useful read-only metadata inspection even though the validator already has a metadata statement path for SHOW, DESCRIBE, and EXPLAIN.How It Changed
PRAGMAso other providers keep their existing allowed statement list.Bug Fixes
Extra Context / Decisions
Verification
rtk mise exec -- bun --cwd packages/server vitest run src/services/data-source-query/validate-sql.test.tsrtk mise exec -- bunx turbo typecheck --json --filter=@onequery/serverrtk mise exec -- bun lint --format jsonrtk mise exec -- bun run formatlint-fullpassed while pushing the branchVideo / Screenshot (Optional)