~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/create.test

  • Committer: Nathan Williams
  • Date: 2009-06-13 21:21:13 UTC
  • mfrom: (1062 staging)
  • mto: This revision was merged to the branch mainline in revision 1063.
  • Revision ID: nathanlws@gmail.com-20090613212113-liz01ojh1wxutgqx
Merged trunk and resolved conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
721
721
 
722
722
 
723
723
#
724
 
# CREATE TABLE ... SELECT and LOCK TABLES
725
 
#
726
 
# There is little sense in using CREATE TABLE ... SELECT under
727
 
# LOCK TABLES as it mostly does not work. At least we check that
728
 
# the server doesn't crash, hang and produces sensible errors.
729
 
# Includes test for bug #20662 "Infinite loop in CREATE TABLE
730
 
# IF NOT EXISTS ... SELECT with locked tables".
731
 
create table t1 (i int);
732
 
insert into t1 values (1), (2);
733
 
lock tables t1 read;
734
 
--error ER_TABLE_NOT_LOCKED
735
 
create table t2 select * from t1;
736
 
--error ER_TABLE_NOT_LOCKED
737
 
create table if not exists t2 select * from t1;
738
 
unlock tables;
739
 
create table t2 (j int);
740
 
lock tables t1 read;
741
 
--error ER_TABLE_NOT_LOCKED
742
 
create table t2 select * from t1;
743
 
# This should not be ever allowed as it will undermine
744
 
# lock-all-at-once approach
745
 
--error ER_TABLE_NOT_LOCKED
746
 
create table if not exists t2 select * from t1;
747
 
unlock tables;
748
 
lock table t1 read, t2 read;
749
 
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
750
 
create table t2 select * from t1;
751
 
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
752
 
create table if not exists t2 select * from t1;
753
 
unlock tables;
754
 
lock table t1 read, t2 write;
755
 
--error ER_TABLE_EXISTS_ERROR
756
 
create table t2 select * from t1;
757
 
# This is the only case which really works.
758
 
create table if not exists t2 select * from t1;
759
 
select * from t1;
760
 
unlock tables;
761
 
drop table t2;
762
 
 
763
 
# OTOH CREATE TEMPORARY TABLE ... SELECT should work
764
 
# well under LOCK TABLES.
765
 
lock tables t1 read;
766
 
create temporary table t2 select * from t1;
767
 
create temporary table if not exists t2 select * from t1;
768
 
select * from t2;
769
 
unlock tables;
770
 
drop table t1, t2;
771
 
 
772
 
 
773
 
#
774
724
# Bug#21772: can not name a column 'upgrade' when create a table
775
725
#
776
726
create table t1 (upgrade int);