List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:May 19 2009 7:52am
Subject:ALTER column DROP DEFAULT test
View as plain text  
noticed in Drizzle lcov that there was no test covering this bit of the
parser (and probably other bits of code). Likely useful for others:


------------------------------------------------------------
revno: 1037
committer: Stewart Smith <stewart@stripped>
branch nick: code-coverage
timestamp: Tue 2009-05-19 17:48:05 +1000
message:
  add missing result file for: add test for ALTER column DROP DEFAULT. Improves
sql_yacc.yy code coverage (among other places)
diff:
=== modified file 'tests/r/alter_column_drop_default.result'
--- tests/r/alter_column_drop_default.result	2009-05-19 07:45:34 +0000
+++ tests/r/alter_column_drop_default.result	2009-05-19 07:48:05 +0000
@@ -0,0 +1,14 @@
+CREATE TABLE t1 (a int NOT NULL default 42);
+INSERT INTO t1 values ();
+SELECT * FROM t1;
+a
+42
+ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
+INSERT INTO t1 values ();
+ERROR HY000: Field 'a' doesn't have a default value
+INSERT INTO t1 (a) VALUES (11);
+SELECT * FROM t1 ORDER BY a;
+a
+11
+42
+DROP TABLE t1;
------------------------------------------------------------
revno: 1036
committer: Stewart Smith <stewart@stripped>
branch nick: code-coverage
timestamp: Tue 2009-05-19 17:45:34 +1000
message:
  add test for ALTER column DROP DEFAULT. Improves sql_yacc.yy code coverage (among other
places)
diff:
=== added file 'tests/r/alter_column_drop_default.result'
=== added file 'tests/t/alter_column_drop_default.test'
--- tests/t/alter_column_drop_default.test	1970-01-01 00:00:00 +0000
+++ tests/t/alter_column_drop_default.test	2009-05-19 07:45:34 +0000
@@ -0,0 +1,9 @@
+CREATE TABLE t1 (a int NOT NULL default 42);
+INSERT INTO t1 values ();
+SELECT * FROM t1;
+ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
+--error 1364
+INSERT INTO t1 values ();
+INSERT INTO t1 (a) VALUES (11);
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;

-- 
Stewart Smith
Thread
ALTER column DROP DEFAULT testStewart Smith19 May
  • Re: ALTER column DROP DEFAULT testSergei Golubchik20 May
    • Re: ALTER column DROP DEFAULT testStewart Smith22 May
      • Re: ALTER column DROP DEFAULT testSergei Golubchik22 May
        • Re: ALTER column DROP DEFAULT testMichael Widenius7 Jun
          • Re: ALTER column DROP DEFAULT testStewart Smith8 Jul