Skip to content

Commit 52de462

Browse files
committed
add bit to unsigned typecheck and script test
1 parent c76b4ab commit 52de462

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

enginetest/queries/script_queries.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,20 @@ type ScriptTestAssertion struct {
120120
// Unlike other engine tests, ScriptTests must be self-contained. No other tables are created outside the definition of
121121
// the tests.
122122
var ScriptTests = []ScriptTest{
123+
{
124+
// Regression test for https://github.com/dolthub/dolt/issues/9641
125+
Name: "bit union regression test dolt#9641",
126+
SetUpScript: []string{
127+
"CREATE TABLE bit_test_table (id INT PRIMARY KEY, flag BIT(1))",
128+
"INSERT INTO bit_test_table VALUES (1, 0), (2, 1)",
129+
},
130+
Assertions: []ScriptTestAssertion{
131+
{
132+
Query: "SELECT flag FROM bit_test_table WHERE id = 1 UNION SELECT NULL as flag",
133+
Expected: []sql.Row{{uint64(0)}, {nil}},
134+
},
135+
},
136+
},
123137
{
124138
Name: "outer join finish unmatched right side",
125139
SetUpScript: []string{

sql/types/typecheck.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func IsUnsigned(t sql.Type) bool {
230230
if svt, ok := t.(sql.SystemVariableType); ok {
231231
t = svt.UnderlyingType()
232232
}
233-
return t == Uint8 || t == Uint16 || t == Uint24 || t == Uint32 || t == Uint64
233+
return t == Uint8 || t == Uint16 || t == Uint24 || t == Uint32 || t == Uint64 || IsBit(t)
234234
}
235235

236236
// IsYear checks if t is a year type.

0 commit comments

Comments
 (0)