@@ -122,148 +122,6 @@ type ScriptTestAssertion struct {
122122// Unlike other engine tests, ScriptTests must be self-contained. No other tables are created outside the definition of
123123// the tests.
124124var ScriptTests = []ScriptTest {
125- {
126- // https://github.com/dolthub/dolt/issues/9316
127- Name : "CREATE TABLE with constraints AS SELECT osticket repro" ,
128- SkipPrepared : true , // SHOW KEYS with WHERE clause doesn't work with prepared statements
129- SetUpScript : []string {
130- "CREATE TABLE ost_form_entry (id INT PRIMARY KEY, object_id INT, object_type VARCHAR(1))" ,
131- "CREATE TABLE ost_form_entry_values (entry_id INT, field_id INT, value VARCHAR(100), value_id INT)" ,
132- "CREATE TABLE ost_form_field (id INT PRIMARY KEY)" ,
133- "INSERT INTO ost_form_entry VALUES (1, 100, 'U'), (2, 101, 'U'), (3, 102, 'X')" ,
134- "INSERT INTO ost_form_entry_values VALUES (1, 1, '[email protected] ', 1000), (2, 1, '[email protected] ', 1001), (3, 2, 'other', 2000)" ,
135- "INSERT INTO ost_form_field VALUES (1), (2)" ,
136- },
137- Assertions : []ScriptTestAssertion {
138- {
139- Query : `CREATE TABLE IF NOT EXISTS ost_user__cdata (
140- PRIMARY KEY (user_id)
141- ) DEFAULT CHARSET=utf8 AS
142- SELECT
143- entry.object_id as user_id,
144- MAX(IF(field.id='1',coalesce(ans.value_id, ans.value),NULL)) as email
145- FROM ost_form_entry entry
146- JOIN ost_form_entry_values ans
147- ON ans.entry_id = entry.id
148- JOIN ost_form_field field
149- ON field.id=ans.field_id
150- WHERE entry.object_type='U' GROUP BY entry.object_id` ,
151- },
152- {
153- Query : "SELECT * FROM ost_user__cdata ORDER BY user_id" ,
154- Expected : []sql.Row {
155- {100 , "1000" },
156- {101 , "1001" },
157- },
158- },
159- {
160- Query : "SHOW KEYS FROM ost_user__cdata WHERE Key_name = 'PRIMARY'" ,
161- Expected : []sql.Row {
162- {"ost_user__cdata" , 0 , "PRIMARY" , 1 , "user_id" , nil , 0 , nil , nil , "" , "BTREE" , "" , "" , "YES" , nil },
163- },
164- },
165- },
166- },
167- {
168- // https://github.com/dolthub/dolt/issues/9316
169- Name : "CREATE TABLE with constraints AS SELECT" ,
170- SkipPrepared : true ,
171- SetUpScript : []string {
172- "CREATE TABLE t1 (a int not null, b varchar(10))" ,
173- "INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three')" ,
174- "CREATE TABLE source (id int, name varchar(20))" ,
175- "INSERT INTO source VALUES (1, 'alice'), (2, 'bob'), (3, 'charlie')" ,
176- "CREATE TABLE override_src (a bigint, b int)" ,
177- "INSERT INTO override_src VALUES (100, 200)" ,
178- "CREATE TABLE base (a int, b varchar(10))" ,
179- "INSERT INTO base VALUES (1, 'alpha'), (2, 'beta')" ,
180- "CREATE TABLE multi_src (id int, email varchar(50), age int)" ,
181- "INSERT INTO multi_src VALUES (1, '[email protected] ', 25), (2, '[email protected] ', 30)" ,
182- },
183- Assertions : []ScriptTestAssertion {
184- {
185- Query : "CREATE TABLE t2 (PRIMARY KEY(a)) SELECT * FROM t1" ,
186- },
187- {
188- Query : "SELECT * FROM t2 ORDER BY a" ,
189- Expected : []sql.Row {
190- {1 , "one" },
191- {2 , "two" },
192- {3 , "three" },
193- },
194- },
195- {
196- Query : "SHOW KEYS FROM t2 WHERE Key_name = 'PRIMARY'" ,
197- Expected : []sql.Row {
198- {"t2" , 0 , "PRIMARY" , 1 , "a" , nil , 0 , nil , nil , "" , "BTREE" , "" , "" , "YES" , nil },
199- },
200- },
201- {
202- Query : "CREATE TABLE indexed (KEY(name)) SELECT * FROM source" ,
203- },
204- {
205- Query : "SELECT * FROM indexed ORDER BY id" ,
206- Expected : []sql.Row {
207- {1 , "alice" },
208- {2 , "bob" },
209- {3 , "charlie" },
210- },
211- },
212- {
213- Query : "SHOW KEYS FROM indexed WHERE Key_name = 'name'" ,
214- Expected : []sql.Row {
215- {"indexed" , 1 , "name" , 1 , "name" , nil , 0 , nil , nil , "YES" , "BTREE" , "" , "" , "YES" , nil },
216- },
217- },
218- {
219- Query : "CREATE TABLE override (a TINYINT NOT NULL) SELECT a, b FROM override_src" ,
220- },
221- {
222- Query : "SELECT * FROM override" ,
223- Expected : []sql.Row {
224- {int8 (100 ), 200 },
225- },
226- },
227- {
228- Query : "SHOW CREATE TABLE override" ,
229- Expected : []sql.Row {
230- {"override" , "CREATE TABLE `override` (\n `a` tinyint NOT NULL,\n `b` int\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
231- },
232- },
233- {
234- Query : "CREATE TABLE uniq (UNIQUE KEY(a)) SELECT * FROM base" ,
235- },
236- {
237- Query : "SELECT * FROM uniq ORDER BY a" ,
238- Expected : []sql.Row {
239- {1 , "alpha" },
240- {2 , "beta" },
241- },
242- },
243- {
244- Query : "SHOW KEYS FROM uniq WHERE Key_name = 'a'" ,
245- Expected : []sql.Row {
246- {"uniq" , 0 , "a" , 1 , "a" , nil , 0 , nil , nil , "YES" , "BTREE" , "" , "" , "YES" , nil },
247- },
248- },
249- {
250- Query : "CREATE TABLE multi_idx (PRIMARY KEY(id), KEY(email), KEY(age)) SELECT * FROM multi_src" ,
251- },
252- {
253- Query : "SELECT * FROM multi_idx ORDER BY id" ,
254- Expected : []sql.Row {
255- 256- 257- },
258- },
259- {
260- Query : "SELECT COUNT(*) FROM information_schema.statistics WHERE table_name = 'multi_idx'" ,
261- Expected : []sql.Row {
262- {3 },
263- },
264- },
265- },
266- },
267125 {
268126 // https://github.com/dolthub/dolt/issues/9987
269127 Name : "GROUP BY nil pointer dereference in Dispose when Next() never called" ,
0 commit comments