1#
2# Test different combinations of doing DROP TABLE/SEQUENCE/VIEW
3#
4
5SET @save_default_engine= @@DEFAULT_STORAGE_ENGINE;
6SET default_storage_engine=myisam;
7let $DATADIR= `select @@datadir`;
8
9# Create tables t1,t2, sequences s1,s2 and views v1,v2
10let $create_option=;
11--source drop_combinations.inc
12
13--echo #
14--echo # DROP TABLE
15--echo #
16
17--error ER_BAD_TABLE_ERROR
18drop table t1,t2,t3;
19--replace_result $DATADIR ./
20show warnings;
21--source drop_combinations.inc
22--error ER_BAD_TABLE_ERROR
23drop table t1,t3,t2;
24--replace_result $DATADIR ./
25show warnings;
26--source drop_combinations.inc
27--error ER_BAD_TABLE_ERROR
28drop table t1,t4,t2,t3;
29--replace_result $DATADIR ./
30show warnings;
31--source drop_combinations.inc
32drop table t1,s1,s2,t2;
33--source drop_combinations.inc
34--error ER_IT_IS_A_VIEW
35drop table t1,v1,v2,t2;
36--replace_result $DATADIR ./
37show warnings;
38--source drop_combinations.inc
39--error ER_IT_IS_A_VIEW
40drop table v1,s1,s2,v2,t2;
41--replace_result $DATADIR ./
42show warnings;
43--source drop_combinations.inc
44--remove_file $DATADIR/test/t1.MYD
45--replace_result $DATADIR ./
46--error ER_IT_IS_A_VIEW
47drop table t1,s1,v1,t3,t4;
48--replace_result $DATADIR ./
49show warnings;
50--error ER_IT_IS_A_VIEW
51drop table s2,v2,t2,t1;
52--replace_result $DATADIR ./
53show warnings;
54--source drop_combinations.inc
55--replace_result $DATADIR ./
56--error ER_IT_IS_A_VIEW
57drop table s1,v1,s2,v2;
58--replace_result $DATADIR ./
59show warnings;
60--source drop_combinations.inc
61
62--echo #
63--echo # DROP TABLE with if exists
64--echo #
65
66drop table if exists t1,t2,t3;
67--source drop_combinations.inc
68drop table if exists t1,t3,t2;
69--source drop_combinations.inc
70drop table if exists t1,t4,t2,t3;
71--source drop_combinations.inc
72drop table if exists t1,s1,s2,t2;
73--source drop_combinations.inc
74drop table if exists t1,v1,v2,t2;
75--source drop_combinations.inc
76drop table if exists v1,s1,s2,v2,t2;
77--source drop_combinations.inc
78--remove_file $DATADIR/test/t1.MYD
79--replace_result \\ /
80--replace_result $DATADIR ./
81drop table if exists t1,s1,v1,t3,t4;
82drop table if exists s2,v2,t2,t1;
83--source drop_combinations.inc
84--replace_result $DATADIR ./
85drop table if exists s1,v1,s2,v2;
86--source drop_combinations.inc
87
88--echo #
89--echo # DROP TEMPORARY TABLE
90--echo #
91
92--disable_warnings
93drop table if exists t1,t2;
94drop temporary table if exists tt1,tt2;
95drop sequence if exists s1,s2;
96drop temporary sequence if exists ss1,ss2;
97drop view if exists v1,v2;
98--enable_warnings
99let $create_option=temporary;
100
101--error ER_BAD_TABLE_ERROR
102drop temporary table t1,t2,t3;
103--replace_result $DATADIR ./
104show warnings;
105--source drop_combinations.inc
106--error ER_BAD_TABLE_ERROR
107drop temporary table t1,t3,t2;
108--replace_result $DATADIR ./
109show warnings;
110--source drop_combinations.inc
111--error ER_BAD_TABLE_ERROR
112drop temporary table t1,t4,t2,t3;
113--replace_result $DATADIR ./
114show warnings;
115--source drop_combinations.inc
116drop temporary table t1,s1,s2,t2;
117--source drop_combinations.inc
118--error ER_BAD_TABLE_ERROR
119drop temporary table t1,v1,v2,t2;
120--replace_result $DATADIR ./
121show warnings;
122--source drop_combinations.inc
123--error ER_BAD_TABLE_ERROR
124drop temporary table v1,s1,s2,v2,t2;
125--replace_result $DATADIR ./
126show warnings;
127--source drop_combinations.inc
128--error ER_BAD_TABLE_ERROR
129drop temporary table t1,s1,v1,t3,t4;
130--replace_result $DATADIR ./
131show warnings;
132--source drop_combinations.inc
133--error ER_BAD_TABLE_ERROR
134drop temporary table s2,v2,t2,t1;
135--replace_result $DATADIR ./
136show warnings;
137--source drop_combinations.inc
138--error ER_BAD_TABLE_ERROR
139drop temporary table s1,v1,s2,v2;
140--replace_result $DATADIR ./
141show warnings;
142--source drop_combinations.inc
143
144--echo #
145--echo # DROP TEMPORARY TABLE with if exists
146--echo #
147
148drop temporary table if exists t1,t2,t3;
149--source drop_combinations.inc
150drop temporary table if exists t1,t3,t2;
151--source drop_combinations.inc
152drop temporary table if exists t1,t4,t2,t3;
153--source drop_combinations.inc
154drop temporary table if exists t1,s1,s2,t2;
155--source drop_combinations.inc
156drop temporary table if exists t1,v1,v2,t2;
157--source drop_combinations.inc
158drop temporary table if exists v1,s1,s2,v2,t2;
159--source drop_combinations.inc
160drop temporary table if exists t1,s1,v1,t3,t4;
161drop temporary table if exists s2,v2,t2,t1;
162--source drop_combinations.inc
163drop temporary table if exists s1,v1,s2,v2;
164--source drop_combinations.inc
165
166let $create_option=;
167drop temporary table t1,t2;
168drop temporary sequence s1,s2;
169--source drop_combinations.inc
170
171--echo #
172--echo # DROP SEQUENCE
173--echo #
174
175--error ER_UNKNOWN_SEQUENCES
176drop sequence s1,s2,s3;
177--replace_result $DATADIR ./
178show warnings;
179--source drop_combinations.inc
180--error ER_UNKNOWN_SEQUENCES
181drop sequence s1,s3,s2;
182--replace_result $DATADIR ./
183show warnings;
184--source drop_combinations.inc
185--error ER_UNKNOWN_SEQUENCES
186drop sequence s1,s4,s2,s3;
187--replace_result $DATADIR ./
188show warnings;
189--source drop_combinations.inc
190--error ER_NOT_SEQUENCE2
191drop sequence s1,t1,t2,s2,s3,s4;
192--replace_result $DATADIR ./
193show warnings;
194--source drop_combinations.inc
195--error ER_IT_IS_A_VIEW
196drop sequence s1,v1,v2,s2;
197--replace_result $DATADIR ./
198show warnings;
199--source drop_combinations.inc
200--error ER_IT_IS_A_VIEW
201drop sequence v1,t1,t2,v2,s2;
202--replace_result $DATADIR ./
203show warnings;
204--error ER_NOT_SEQUENCE2
205drop sequence t1,v1,t2,v2,s2;
206--replace_result $DATADIR ./
207show warnings;
208--source drop_combinations.inc
209--remove_file $DATADIR/test/s1.MYD
210--replace_result \\ /
211--error ER_NOT_SEQUENCE2
212drop sequence s1,t1,v1,t3,s4;
213--replace_result $DATADIR ./
214show warnings;
215--error ER_NOT_SEQUENCE2
216drop sequence t2,v2,s2,s1;
217--replace_result $DATADIR ./
218show warnings;
219--source drop_combinations.inc
220--error ER_NOT_SEQUENCE2
221drop sequence t1,v1,t2,v2;
222--replace_result $DATADIR ./
223show warnings;
224--source drop_combinations.inc
225
226--echo #
227--echo # DROP SEQUENCE with if exists
228--echo #
229
230drop sequence if exists s1,s2,s3;
231--source drop_combinations.inc
232drop sequence if exists s1,s3,s2;
233--source drop_combinations.inc
234drop sequence if exists s1,s4,s2,s3;
235--source drop_combinations.inc
236drop sequence if exists s1,t1,t2,s2;
237--source drop_combinations.inc
238drop sequence if exists s1,v1,v2,s2;
239--source drop_combinations.inc
240drop sequence if exists v1,t1,t2,v2,s2;
241--source drop_combinations.inc
242--remove_file $DATADIR/test/s1.MYD
243--replace_result \\ /
244--replace_result $DATADIR ./
245drop sequence if exists s1,t1,v1,t3,s4;
246drop sequence if exists t2,v2,s2,s1;
247--source drop_combinations.inc
248drop sequence if exists t1,v1,t2,v2;
249--source drop_combinations.inc
250
251--echo #
252--echo # DROP TEMPORARY SEQUENCE
253--echo #
254
255--disable_warnings
256drop table if exists t1,t2;
257drop temporary table if exists tt1,tt2;
258drop sequence if exists s1,s2;
259drop temporary sequence if exists ss1,ss2;
260drop view if exists v1,v2;
261--enable_warnings
262let $create_option=temporary;
263--source drop_combinations.inc
264
265--error ER_UNKNOWN_SEQUENCES
266drop temporary sequence s1,s2,s3;
267--replace_result $DATADIR ./
268show warnings;
269--source drop_combinations.inc
270--error ER_UNKNOWN_SEQUENCES
271drop temporary sequence s1,s3,s2;
272--replace_result $DATADIR ./
273show warnings;
274--source drop_combinations.inc
275--error ER_UNKNOWN_SEQUENCES
276drop temporary sequence s1,s4,s2,s3;
277--replace_result $DATADIR ./
278show warnings;
279--source drop_combinations.inc
280--error ER_UNKNOWN_SEQUENCES
281drop temporary sequence s1,t1,t2,s2;
282--replace_result $DATADIR ./
283show warnings;
284--source drop_combinations.inc
285--error ER_UNKNOWN_SEQUENCES
286drop temporary sequence s1,v1,v2,s2;
287--replace_result $DATADIR ./
288show warnings;
289--source drop_combinations.inc
290--error ER_UNKNOWN_SEQUENCES
291drop temporary sequence v1,t1,t2,v2,s2;
292--replace_result $DATADIR ./
293show warnings;
294--source drop_combinations.inc
295--error ER_UNKNOWN_SEQUENCES
296drop temporary sequence s1,t1,v1,t3,s4;
297--replace_result $DATADIR ./
298show warnings;
299--error ER_UNKNOWN_SEQUENCES
300drop temporary sequence t2,v2,s2,s1;
301--replace_result $DATADIR ./
302show warnings;
303--source drop_combinations.inc
304--error ER_UNKNOWN_SEQUENCES
305drop temporary sequence t1,v1,t2,v2;
306--replace_result $DATADIR ./
307show warnings;
308--source drop_combinations.inc
309
310--echo #
311--echo # DROP TEMPORARY SEQUENCE with if exists
312--echo #
313
314drop temporary sequence if exists s1,s2,s3;
315--source drop_combinations.inc
316drop temporary sequence if exists s1,s3,s2;
317--source drop_combinations.inc
318drop temporary sequence if exists s1,s4,s2,s3;
319--source drop_combinations.inc
320drop temporary sequence if exists s1,t1,t2,s2;
321--source drop_combinations.inc
322drop temporary sequence if exists s1,v1,v2,s2;
323--source drop_combinations.inc
324drop temporary sequence if exists v1,t1,t2,v2,s2;
325--source drop_combinations.inc
326drop temporary sequence if exists s1,t1,v1,t3,s4;
327drop temporary sequence if exists t2,v2,s2,s1;
328--source drop_combinations.inc
329drop temporary sequence if exists t1,v1,t2,v2;
330--source drop_combinations.inc
331
332let $create_option=;
333drop temporary table t1,t2;
334drop temporary sequence s1,s2;
335--source drop_combinations.inc
336
337--echo #
338--echo # DROP VIEW
339--echo #
340
341--error ER_UNKNOWN_VIEW
342drop view v1,v2,v3;
343--replace_result $DATADIR ./
344show warnings;
345--source drop_combinations.inc
346--error ER_UNKNOWN_VIEW
347drop view v1,v3,v2;
348--replace_result $DATADIR ./
349show warnings;
350--source drop_combinations.inc
351--error ER_UNKNOWN_VIEW
352drop view v1,v4,v2,v3;
353--replace_result $DATADIR ./
354show warnings;
355--source drop_combinations.inc
356--error ER_UNKNOWN_VIEW
357drop view v1,t1,t2,v2;
358--replace_result $DATADIR ./
359show warnings;
360--source drop_combinations.inc
361--error ER_UNKNOWN_VIEW
362drop view v1,s1,s2,v2;
363--replace_result $DATADIR ./
364show warnings;
365--source drop_combinations.inc
366--remove_file $DATADIR/test/t1.MYD
367--replace_result \\ /
368--error ER_UNKNOWN_VIEW
369drop view s1,t1,t2,s2,v2;
370--replace_result $DATADIR ./
371show warnings;
372--replace_result $DATADIR ./
373drop table t1;
374--replace_result $DATADIR ./
375show warnings;
376--error ER_UNKNOWN_VIEW
377drop view v1,t1;
378--replace_result $DATADIR ./
379show warnings;
380--source drop_combinations.inc
381--error ER_UNKNOWN_VIEW
382drop view v1,t1,s1,t3,v4;
383--replace_result $DATADIR ./
384show warnings;
385--error ER_UNKNOWN_VIEW
386drop view t2,s2,v2,v1;
387--replace_result $DATADIR ./
388show warnings;
389--source drop_combinations.inc
390--error ER_UNKNOWN_VIEW
391drop view t1,s1,t2,s2;
392--replace_result $DATADIR ./
393show warnings;
394--source drop_combinations.inc
395
396--echo #
397--echo # DROP VIEW with if exists
398--echo #
399
400drop view if exists v1,v2,v3;
401--source drop_combinations.inc
402drop view if exists v1,v3,v2;
403--source drop_combinations.inc
404drop view if exists v1,v4,v2,v3;
405--source drop_combinations.inc
406drop view if exists v1,t1,t2,v2;
407--source drop_combinations.inc
408drop view if exists v1,s1,s2,v2;
409--source drop_combinations.inc
410drop view if exists s1,t1,t2,s2,v2;
411drop table t1;
412drop view if exists v1,t1;
413--source drop_combinations.inc
414drop view if exists v1,t1,s1,t3,v4;
415drop view if exists t2,s2,v2,v1;
416--source drop_combinations.inc
417drop view if exists t1,s1,t2,s2;
418--source drop_combinations.inc
419
420--echo # cleanup
421drop table if exists t1,t2;
422drop sequence if exists s1,s2;
423drop view if exists v1,v2;
424
425SET default_storage_engine=@save_default_engine;
426