"Fossies" - the Fresh Open Source Software Archive

Member "drizzle-7.1.36-stable/tests/suite/regression/t/686197.test" (6 May 2012, 906 Bytes) of package /linux/misc/old/drizzle-7.1.36-stable.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # A field which is marked NOT NULL has no DEFAULT value should create an
    2 # error.
    3 CREATE TABLE t1 (A SERIAL);
    4 INSERT INTO t1 VALUES (), (), ();
    5 SELECT A from t1 ORDER BY A;
    6 --error ER_INVALID_ALTER_TABLE_FOR_NOT_NULL
    7 ALTER TABLE t1 ADD COLUMN b INT NOT NULL;
    8 SELECT A from t1 ORDER BY A;
    9 SHOW CREATE TABLE t1;
   10 ALTER TABLE t1 ADD COLUMN b INT DEFAULT 1 NOT NULL;
   11 SELECT A,B from t1 ORDER BY A;
   12 DROP TABLE t1;
   13 
   14 CREATE TABLE t1 (A SERIAL, b int);
   15 INSERT INTO t1 VALUES (), (), ();
   16 SELECT A,B from t1 ORDER BY A;
   17 --error ER_WARN_DATA_TRUNCATED
   18 ALTER TABLE t1 MODIFY COLUMN b int not null;
   19 SELECT A,B from t1 ORDER BY A;
   20 SHOW CREATE TABLE t1;
   21 ALTER TABLE t1 MODIFY COLUMN b int DEFAULT 42 NOT NULL;
   22 SELECT A,B from t1 ORDER BY A;
   23 DROP TABLE t1;
   24 
   25 CREATE TABLE t1 (col6 int not null);
   26 INSERT INTO t1 VALUES (2);
   27 SELECT * FROM t1;
   28 
   29 alter table t1 modify column col6 int not null;
   30 
   31 select * from t1;
   32 drop table t1;