Repository navigation
fix: convert the clock under the built-in policy and guard only read semi-structured columns - #133
Merged
Merged
Conversation
…structured columns a query reads The built-in default now converts CURRENT_DATE() and CURRENT_TIMESTAMP() with a warning that states the caveat: both engines take the value when the query runs, in the session's time zone. Strict mode, --loud-divergences-only and a session outside UTC still refuse them. A base table's VARIANT, ARRAY and OBJECT columns are guarded, relying on json_fidelity, only where the statement can read them: it names the column, or reads columns without naming them through a star other than COUNT(*), a positional column, PIVOT, UNPIVOT or a NATURAL join. Reading another column of such a table no longer needs json_fidelity.
Contributor
Author
|
D94 gate on fc15d51 (this head, merging main f2d93ee), run locally with every crate rebuilt from this worktree:
Hosted CI on this repository is blocked by Actions billing, so the local gate is the landing check. |
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.
Why
Two refusals under the built-in policy blocked everyday queries:
CURRENT_DATE()andCURRENT_TIMESTAMP()refused, although both engines read the clock when the query runs; the value differing between runs is not a translation error.json_fidelity, even when the query never read the semi-structured column (SELECT ticket_id FROM tickets).Changes
CURRENT_DATE()andCURRENT_TIMESTAMP()with a note stating the caveat: the value is taken when the query runs, in the session's time zone, which must be UTC in both engines.--strict,--loud-divergences-onlyand a non-UTCTIMEZONEstill refuse them, with help naming the flag to drop.json_fidelity, only where the statement can read them: it names the column, or reads columns unnamed through a star other thanCOUNT(*), a positional$n, PIVOT, UNPIVOT, COLUMNS or a NATURAL join. Columns with names outside plain ASCII are always guarded.--builtin-policyhelp and SQ0008 help say the built-in policy refuses every known divergence but the clock.test_builtin_policy.rscover both changes, including reads that must stay guarded.Verification
make check-ciexit 0;make test-rustpassed;make verify-recorded: 12,033 cases, 0 failed, 0 pending, 226/226 rules; translation results: 0 regressions, 0 other changes, main's baseline unchanged.SELECT ticket_id FROM ticketsrefused on main and converts here; star, named, positional and subquery reads still rely onjson_fidelity.