~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/inc/partition_alter_1.inc

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
################################################################################
 
2
# inc/partition_alter_1.inc                                                    #
 
3
#                                                                              #
 
4
# Purpose:                                                                     #
 
5
#   Alter a partioned table and check the usability afterwards                 #
 
6
#   This script is only usefule when sourced by                                #
 
7
#        inc/partition_alter_1[1|3].inc                                        #
 
8
#                                                                              #
 
9
#    0. Expect there is a table t1                                             #
 
10
#    1. Insert the first half of the table t0_template into t1                 #
 
11
#    2. Execute the ALTER TABLE statement within the variable $alter           #
 
12
#       Case SQL code in                                                       #
 
13
#          0: 1. Insert the second half of the table t0_template into t1       #
 
14
#             2. Execute the usability test inc/partition_check.inc            #
 
15
#          >0, but expected: nothing                                           #
 
16
#          >0 and unexpected: abort                                            #
 
17
#    3. DROP the table t1                                                      #
 
18
#                                                                              #
 
19
# The parameter $alter has to be set before sourcing this script.              #
 
20
# Example:                                                                     #
 
21
#          CREATE TABLE t1 (f_int1 INT,f_int2 INT, .... );                     #
 
22
#          let $alter= ALTER TABLE t1 ADD PRIMARY KEY(f_int2);                 #
 
23
#          inc/partition_alter_1.inc                                           #
 
24
#                                                                              #
 
25
# The parameters $insert_first_half and $insert_second_half                    #
 
26
# are also to be set outside (source ./inc/partition.pre).                     #
 
27
#                                                                              #
 
28
#------------------------------------------------------------------------------#
 
29
# Original Author: mleich                                                      #
 
30
# Original Date:   2006-03-05                                                  #
 
31
# Change Author:   mleich                                                      #
 
32
# Change Date:     2007-10-08                                                  #
 
33
# Change:          Fix for                                                     #
 
34
#                  Bug#31481 test suite parts: Many tests fail because of      #
 
35
#                            changed server error codes                        #
 
36
################################################################################
 
37
 
 
38
eval $insert_first_half;
 
39
# Possible/Expected return codes for ALTER TABLE ...
 
40
# 0
 
41
# 1030: ER_GET_ERRNO
 
42
# 1502: ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
 
43
# 1506: ER_DROP_PARTITION_NON_EXISTENT
 
44
--disable_abort_on_error
 
45
eval $alter;
 
46
--enable_abort_on_error
 
47
if ($no_debug)
 
48
{
 
49
--disable_query_log
 
50
}
 
51
eval SET @my_errno = $mysql_errno;
 
52
let $run_test= `SELECT @my_errno = 0`;
 
53
if (`SELECT @my_errno NOT IN (0,$ER_GET_ERRNO,
 
54
                              $ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF,
 
55
                              $ER_DROP_PARTITION_NON_EXISTENT)`);
 
56
{
 
57
   --echo #      The last command got an unexepected error response.
 
58
   --echo #      Expected/handled SQL codes are 0,$ER_GET_ERRNO,$ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF,$ER_DROP_PARTITION_NON_EXISTENT
 
59
   SELECT '#      SQL code we got was: ' AS "", @my_errno AS "";
 
60
   --echo #      Sorry, have to abort.
 
61
   --echo #      Please check the error name to number mapping in inc/partition.pre.
 
62
   exit;
 
63
   --echo
 
64
}
 
65
--enable_query_log
 
66
# Prevent execution of following usage tests, when ALTER TABLE failed
 
67
if ($run_test)
 
68
{
 
69
eval $insert_second_half;
 
70
--source suite/parts/inc/partition_check.inc
 
71
}
 
72
DROP TABLE t1;