mariadb/mysql-test/suite/partitions/include/partition_syntax_1.inc
unknown ee5eb8bbe1 copy from test-extra-5.1 to main tree
BitKeeper/etc/ignore:
  Added mysql-test/suite/funcs_1/r/innodb_views.warnings mysql-test/suite/funcs_1/r/memory_trig_03e.warnings mysql-test/suite/funcs_1/r/memory_views.warnings mysql-test/suite/funcs_1/r/myisam_trig_03e.warnings mysql-test/suite/funcs_1/r/myisam_views.warnings mysql-test/suite/funcs_1/r/ndb_trig_03e.warnings mysql-test/suite/funcs_1/r/ndb_views.warnings mysql-test/suite/partitions/r/diff mysql-test/suite/partitions/r/partition_bit_ndb.warnings mysql-test/suite/partitions/r/partition_special_innodb.warnings mysql-test/suite/partitions/r/partition_special_myisam.warnings storage/archive/archive_reader mysql-test/suite/funcs_1/r/innodb_trig_03e.warnings to the ignore list
mysql-test/suite/funcs_2/include/check_charset.inc:
  inserted newline at the end of file.
mysql-test/suite/objects/include/drop_all.inc:
  inserted newline at the end of file.
mysql-test/suite/partitions/include/partition_key_32col.inc:
  inserted newline at the end of file.
mysql-test/suite/rpl/data/rpl_mixed.dat:
  inserted newline at the end of file.
mysql-test/suite/rpl/include/rpl_mixed_check_event.inc:
  inserted newline at the end of file.
mysql-test/suite/rpl/include/rpl_mixed_check_select.inc:
  inserted newline at the end of file.
mysql-test/suite/rpl/include/rpl_mixed_check_user.inc:
  inserted newline at the end of file.
mysql-test/suite/rpl/include/rpl_mixed_check_view.inc:
  inserted newline at the end of file.
2007-02-06 13:35:54 +01:00

91 lines
3.8 KiB
PHP

################################################################################
# include/partition_syntax_1.inc #
# #
# Purpose: #
# Auxiliary script, only useful when sourced by include/partition_syntax.inc #
# #
# Try to create a table with number of partitions/subpartitions #
# = $part_number. Print the layout of the table and drop it. #
# #
# The parameter $part_number must be set before sourcing this script. #
# #
#------------------------------------------------------------------------------#
# Original Author: ML #
# Original Date: 2006-03-05 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
--disable_abort_on_error
eval CREATE TABLE t1 (
$column_list
)
PARTITION BY HASH(f_int1) PARTITIONS $part_number;
--enable_abort_on_error
--disable_query_log
eval SET @my_errno= $mysql_errno ;
let $run= `SELECT @my_errno = 0`;
# Expected error codes are
# 0
# 1064 ERROR 42000: You have an error in your SQL syntax
# Reason: assign -1 partitions
# 1486 ERROR HY000: Too many partitions (including subpartitions) were defined
# 1491 ERROR HY000: Number of partitions = 0 is not an allowed value
let $unexpected_error= `SELECT @my_errno NOT IN (0,1064,1487,1492)`;
if ($unexpected_error)
{
--echo # The last command got an unexepected error response.
--echo # Expected/handled SQL codes are 0,1064,1487,1492
SELECT '# SQL code we got was: ' AS "", @my_errno AS "";
--echo # Sorry, have to abort.
exit;
--echo
}
--enable_query_log
#
# If this operation was successfull, print layout + drop this table
if ($run)
{
--source suite/partitions/include/partition_layout_check1.inc
# --source include/partition_layout_check1.inc
eval DROP TABLE t1;
}
#### Try to create a table with the given subpartition number
--disable_abort_on_error
eval CREATE TABLE t1 (
$column_list
)
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1)
SUBPARTITIONS $part_number
(PARTITION part1 VALUES LESS THAN ($max_row_div2),
PARTITION part2 VALUES LESS THAN $MAX_VALUE);
--enable_abort_on_error
--disable_query_log
eval SET @my_errno= $mysql_errno ;
let $run= `SELECT @my_errno = 0`;
# Expected error codes are
# 0
# 1064 ERROR 42000: You have an error in your SQL syntax
# Reason: assign -1 subpartitions
# 1487 ERROR HY000: Too many partitions (including subpartitions) were defined
# 1492 ERROR HY000: Number of partitions = 0 is not an allowed value
let $unexpected_error= `SELECT @my_errno NOT IN (0,1064,1487,1492)`;
if ($unexpected_error)
{
--echo # The last command got an unexepected error response.
--echo # Expected/handled SQL codes are 0,1064,1487,1492
SELECT '# SQL code we got was: ' AS "", @my_errno AS "";
--echo # Sorry, have to abort.
exit;
--echo
}
--enable_query_log
#
# If this operation was successfull, print layout + drop this table
if ($run)
{
--source suite/partitions/include/partition_layout_check1.inc
# --source include/partition_layout_check1.inc
eval DROP TABLE t1;
}