Commit ae19168
committed
fix(sqlite): Convert boolean literals (true/false) to bool type
Previously, SQLite boolean literals like `SELECT true` were incorrectly
converted to int64 type, while PostgreSQL correctly returned bool.
The ANTLR parser provides TRUE_() and FALSE_() tokens, but these were
originally implemented to return Integer in PR #1447 (2022-02-19) without
specific reasoning, likely because SQLite internally uses integers (1/0)
for boolean values.
This fix changes the TRUE_()/FALSE_() handling to return ast.Boolean
instead of ast.Integer, aligning SQLite's behavior with PostgreSQL
and providing a more type-safe interface.
Test results:
- SELECT true/false → bool (was int64)
- SELECT TRUE/FALSE → bool (was int64)
- SELECT 1 → int64 (unchanged)
Added test: internal/endtoend/testdata/select_true_literal/sqlite/1 parent 9d6b46c commit ae19168
File tree
6 files changed
+132
-6
lines changed- internal
- endtoend/testdata/select_true_literal/sqlite
- db
- engine/sqlite
6 files changed
+132
-6
lines changedLines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
752 | 752 | | |
753 | 753 | | |
754 | 754 | | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | 755 | | |
761 | | - | |
| 756 | + | |
762 | 757 | | |
763 | 758 | | |
764 | 759 | | |
| |||
0 commit comments