Skip to content

Commit 589aa8e

Browse files
committed
fix tests
1 parent 9944f31 commit 589aa8e

File tree

5 files changed

+79
-95
lines changed

5 files changed

+79
-95
lines changed

enginetest/memory_engine_test.go

Lines changed: 4 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -200,103 +200,24 @@ func TestSingleQueryPrepared(t *testing.T) {
200200

201201
// Convenience test for debugging a single query. Unskip and set to the desired query.
202202
func TestSingleScript(t *testing.T) {
203-
// t.Skip()
203+
t.Skip()
204204
var scripts = []queries.ScriptTest{
205205
{
206-
Name: "Reproduction test for issue 9872: TEXT(m) syntax support",
206+
Name: "AS OF propagates to nested CALLs",
207207
SetUpScript: []string{},
208208
Assertions: []queries.ScriptTestAssertion{
209209
{
210-
// https://github.com/dolthub/dolt/issues/9872 - Support for mysql `Text(m)` syntax
211-
Query: "CREATE TABLE task_instance_note (ti_id VARCHAR(36) NOT NULL, user_id VARCHAR(128), content TEXT(1000), created_at TIMESTAMP(6) NOT NULL, updated_at TIMESTAMP(6) NOT NULL, CONSTRAINT task_instance_note_pkey PRIMARY KEY (ti_id))",
212-
Expected: []sql.Row{
213-
{types.NewOkResult(0)},
214-
},
215-
},
216-
{
217-
Query: "CREATE TABLE test_text_small (id INT PRIMARY KEY, small_text TEXT(255))",
218-
Expected: []sql.Row{
219-
{types.NewOkResult(0)},
220-
},
221-
},
222-
{
223-
Query: "CREATE TABLE test_text_large (id INT PRIMARY KEY, large_text TEXT(65535))",
224-
Expected: []sql.Row{
225-
{types.NewOkResult(0)},
226-
},
227-
},
228-
{
229-
Query: "CREATE TABLE test_text_medium (id INT PRIMARY KEY, medium_text TEXT(16777215))",
230-
Expected: []sql.Row{
231-
{types.NewOkResult(0)},
232-
},
233-
},
234-
{
235-
Query: "CREATE TABLE test_text_10k (id INT PRIMARY KEY, text_10k TEXT(10000))",
210+
Query: "create procedure create_proc() create table t (i int primary key, j int);",
236211
Expected: []sql.Row{
237212
{types.NewOkResult(0)},
238213
},
239214
},
240215
{
241-
Query: "CREATE TABLE test_text_100k (id INT PRIMARY KEY, text_100k TEXT(100000))",
216+
Query: "call create_proc()",
242217
Expected: []sql.Row{
243218
{types.NewOkResult(0)},
244219
},
245220
},
246-
{
247-
Query: "CREATE TABLE test_text_1m (id INT PRIMARY KEY, text_1m TEXT(1000000))",
248-
Expected: []sql.Row{
249-
{types.NewOkResult(0)},
250-
},
251-
},
252-
{
253-
Query: "CREATE TABLE test_text_no_length (id INT PRIMARY KEY, text_no_length TEXT)",
254-
Expected: []sql.Row{
255-
{types.NewOkResult(0)},
256-
},
257-
},
258-
{
259-
Query: "DESCRIBE test_text_small",
260-
Expected: []sql.Row{
261-
{"id", "int", "NO", "PRI", nil, ""},
262-
{"small_text", "text", "YES", "", nil, ""},
263-
},
264-
},
265-
{
266-
Query: "DESCRIBE test_text_large",
267-
Expected: []sql.Row{
268-
{"id", "int", "NO", "PRI", nil, ""},
269-
{"large_text", "mediumtext", "YES", "", nil, ""},
270-
},
271-
},
272-
{
273-
Query: "DESCRIBE test_text_medium",
274-
Expected: []sql.Row{
275-
{"id", "int", "NO", "PRI", nil, ""},
276-
{"medium_text", "longtext", "YES", "", nil, ""},
277-
},
278-
},
279-
{
280-
Query: "DESCRIBE test_text_10k",
281-
Expected: []sql.Row{
282-
{"id", "int", "NO", "PRI", nil, ""},
283-
{"text_10k", "text", "YES", "", nil, ""},
284-
},
285-
},
286-
{
287-
Query: "DESCRIBE test_text_100k",
288-
Expected: []sql.Row{
289-
{"id", "int", "NO", "PRI", nil, ""},
290-
{"text_100k", "mediumtext", "YES", "", nil, ""},
291-
},
292-
},
293-
{
294-
Query: "DESCRIBE test_text_1m",
295-
Expected: []sql.Row{
296-
{"id", "int", "NO", "PRI", nil, ""},
297-
{"text_1m", "mediumtext", "YES", "", nil, ""},
298-
},
299-
},
300221
},
301222
},
302223
}

enginetest/queries/script_queries.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,77 @@ type ScriptTestAssertion struct {
121121
// Unlike other engine tests, ScriptTests must be self-contained. No other tables are created outside the definition of
122122
// the tests.
123123
var ScriptTests = []ScriptTest{
124+
{
125+
// https://github.com/dolthub/dolt/issues/9872
126+
Name: "TEXT(m) syntax support",
127+
SetUpScript: []string{},
128+
Assertions: []ScriptTestAssertion{
129+
{
130+
Query: "CREATE TABLE task_instance_note (ti_id VARCHAR(36) NOT NULL, user_id VARCHAR(128), content TEXT(1000), created_at TIMESTAMP(6) NOT NULL, updated_at TIMESTAMP(6) NOT NULL, CONSTRAINT task_instance_note_pkey PRIMARY KEY (ti_id))",
131+
Expected: []sql.Row{
132+
{types.NewOkResult(0)},
133+
},
134+
},
135+
{
136+
Query: "DESCRIBE task_instance_note",
137+
Expected: []sql.Row{
138+
{"ti_id", "varchar(36)", "NO", "PRI", nil, ""},
139+
{"user_id", "varchar(128)", "YES", "", nil, ""},
140+
{"content", "text", "YES", "", nil, ""},
141+
{"created_at", "timestamp(6)", "NO", "", nil, ""},
142+
{"updated_at", "timestamp(6)", "NO", "", nil, ""},
143+
},
144+
},
145+
{
146+
Query: "CREATE TABLE tiny (t TEXT(255))",
147+
Expected: []sql.Row{
148+
{types.NewOkResult(0)},
149+
},
150+
},
151+
{
152+
Query: "DESCRIBE tiny",
153+
Expected: []sql.Row{
154+
{"t", "tinytext", "YES", "", nil, ""},
155+
},
156+
},
157+
{
158+
Query: "CREATE TABLE smallt (s TEXT(65535))",
159+
Expected: []sql.Row{
160+
{types.NewOkResult(0)},
161+
},
162+
},
163+
{
164+
Query: "DESCRIBE smallt",
165+
Expected: []sql.Row{
166+
{"s", "text", "YES", "", nil, ""},
167+
},
168+
},
169+
{
170+
Query: "CREATE TABLE mediumt (m TEXT(16777215))",
171+
Expected: []sql.Row{
172+
{types.NewOkResult(0)},
173+
},
174+
},
175+
{
176+
Query: "DESCRIBE mediumt",
177+
Expected: []sql.Row{
178+
{"m", "mediumtext", "YES", "", nil, ""},
179+
},
180+
},
181+
{
182+
Query: "CREATE TABLE longt (l TEXT(4294967295))",
183+
Expected: []sql.Row{
184+
{types.NewOkResult(0)},
185+
},
186+
},
187+
{
188+
Query: "DESCRIBE longt",
189+
Expected: []sql.Row{
190+
{"l", "longtext", "YES", "", nil, ""},
191+
},
192+
},
193+
},
194+
},
124195
{
125196
// https://github.com/dolthub/dolt/issues/9857
126197
Name: "UUID_SHORT() function returns 64-bit unsigned integers with proper construction",

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/dolthub/go-icu-regex v0.0.0-20250916051405-78a38d478790
77
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71
88
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
9-
github.com/dolthub/vitess v0.0.0-20250918181259-ed0e1c5cb192
9+
github.com/dolthub/vitess v0.0.0-20250923140123-a3b4a0d072c7
1010
github.com/go-sql-driver/mysql v1.9.3
1111
github.com/gocraft/dbr/v2 v2.7.2
1212
github.com/google/uuid v1.3.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X
2020
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY=
2121
github.com/dolthub/vitess v0.0.0-20250918181259-ed0e1c5cb192 h1:s7Ghoy+x+C/spSjM5/w9MoMIIeXNcBY/fI2oHxWajLM=
2222
github.com/dolthub/vitess v0.0.0-20250918181259-ed0e1c5cb192/go.mod h1:8pvvk5OLaLN9LLxghyczUapn/97l+mBgIb10qC1LG84=
23+
github.com/dolthub/vitess v0.0.0-20250923140123-a3b4a0d072c7 h1:t6LENyAybksSdqJPo2GzbQNa341C50malLl/GHit2Oc=
24+
github.com/dolthub/vitess v0.0.0-20250923140123-a3b4a0d072c7/go.mod h1:8pvvk5OLaLN9LLxghyczUapn/97l+mBgIb10qC1LG84=
2325
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
2426
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
2527
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=

sql/types/conversion.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,7 @@ func ColumnTypeToType(ct *sqlparser.ColumnType) (sql.Type, error) {
268268
if err != nil {
269269
return nil, err
270270
}
271-
// MySQL automatically chooses the appropriate TEXT type based on length
272-
// TEXT(1) to TEXT(65534) → text (65535 max)
273-
// TEXT(65535) to TEXT(16777215) → mediumtext (16777215 max)
274-
// TEXT(16777216) to TEXT(4294967295) → longtext (4294967295 max)
275-
if length < TextBlobMax {
276-
return CreateString(sqltypes.Text, TextBlobMax/collation.CharacterSet().MaxLength(), collation)
277-
} else if length <= MediumTextBlobMax {
278-
return CreateString(sqltypes.Text, MediumTextBlobMax/collation.CharacterSet().MaxLength(), collation)
279-
} else {
280-
return CreateString(sqltypes.Text, LongTextBlobMax/collation.CharacterSet().MaxLength(), collation)
281-
}
271+
return CreateString(sqltypes.Text, length, collation)
282272
case "mediumtext", "mediumblob", "long", "long varchar":
283273
collation, err := sql.ParseCollation(ct.Charset, collate, ct.BinaryCollate)
284274
if err != nil {

0 commit comments

Comments
 (0)