fix(ddl): $value strips option<> from TYPE, breaking VALUE expressions that return NONE#15
Open
gulybyte wants to merge 1 commit into
Open
fix(ddl): $value strips option<> from TYPE, breaking VALUE expressions that return NONE#15gulybyte wants to merge 1 commit into
gulybyte wants to merge 1 commit into
Conversation
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.
$valuewas included in the condition that strips a leadingoption<>fromthe DDL
TYPE, assuming VALUE always produces a non-NONE value. However,VALUE expressions can legitimately return NONE based on runtime conditions
(e.g.
IF cond THEN NONE ELSE $value END).SurrealDB natively supports
TYPE option<number> VALUE ...—option<T>isKind::Either([Kind::None, T]), so NONE passes type validation. The DBultimately calls
clean_none()and omits the field from the document.Only
$defaultand$computedkeep the stripping — both always produce avalue.
$valueno longer stripsoption<>.Fixes the case where:
Would emit TYPE number instead of TYPE option, causing:
Expected 'number' but found 'NONE'