Commit ed2058c
committed
fix(defaults): evaluate arbitrary DEFAULT expressions via const-fold
The DEFAULT resolver previously only handled a small set of hard-coded
keywords (NOW, UUID, etc.) and returned None for everything else.
Add a fallback path that parses the DEFAULT string through sqlparser-rs
and runs it through the planner's constant-folding evaluator, enabling
DEFAULT values like upper('hello'), 1 + 2, or concat('a', 'b') to
resolve at insert time without a Data Plane round-trip.
Also replace wrapping integer arithmetic in the const-folder with
checked variants to prevent silent overflow on constant expressions.1 parent 3e11ca2 commit ed2058c
2 files changed
Lines changed: 29 additions & 4 deletions
File tree
- nodedb-sql/src/planner
- nodedb/src/control/planner/sql_plan_convert/value
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
71 | 96 | | |
0 commit comments