Changeset: f4371d882ec7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f4371d882ec7
Modified Files:
        sql/server/sql_parser.y
        sql/test/pg_regress/Tests/alter_table.stable.err
        sql/test/pg_regress/Tests/alter_table.stable.out
        sql/test/pg_regress/Tests/insert.stable.err
Branch: default
Log Message:

Approved some tests related to the DEFAULT keyword usage


diffs (223 lines):

diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -217,6 +217,7 @@ int yydebug=1;
        opt_order_by_clause
        default
        default_value
+       assign_default
        cast_value
        aggr_ref
        var_ref
@@ -2908,10 +2909,14 @@ assignment_commalist:
                        { $$ = append_symbol($1, $3 ); }
  ;
 
+assign_default:
+    DEFAULT            { $$ = _symbol_create(SQL_DEFAULT, NULL ); }
+ ;
+
 assignment:
-   column '=' DEFAULT
+   column '=' assign_default
        { dlist *l = L();
-         append_symbol(l, _symbol_create(SQL_DEFAULT, NULL ) );
+         append_symbol(l, $3);
          append_string(l, $1);
          $$ = _symbol_create_list( SQL_ASSIGN, l); }
  |  column '=' search_condition
diff --git a/sql/test/pg_regress/Tests/alter_table.stable.err 
b/sql/test/pg_regress/Tests/alter_table.stable.err
--- a/sql/test/pg_regress/Tests/alter_table.stable.err
+++ b/sql/test/pg_regress/Tests/alter_table.stable.err
@@ -252,8 +252,8 @@ MAPI  = (monetdb) /var/tmp/mtest-22572/.
 QUERY = create rule def_view_test_ins as
                on insert to def_view_test
                do instead insert into def_test select new.*;
-ERROR = !syntax error, unexpected IDENT, expecting INDEX in: "create rule"
-MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = insert into def_view_test default values;
 ERROR = !INSERT INTO: cannot insert into view 'def_view_test'
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
@@ -333,32 +333,32 @@ QUERY = insert into atacc1 values (10, 1
 ERROR = !INSERT INTO: number of values doesn't match number of columns of 
table 'atacc1'
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = insert into atacc1 values (default, 11, 12, 13);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into atacc1 values 
(default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = insert into atacc1 (a) values (10);
 ERROR = !INSERT INTO: no such column 'atacc1.a'
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = insert into atacc1 (a) values (default);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into atacc1 (a) values 
(default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = insert into atacc1 (a,b,c,d) values (10,11,12,13);
 ERROR = !INSERT INTO: no such column 'atacc1.a'
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = insert into atacc1 (a,b,c,d) values (default,11,12,13);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into atacc1 (a,b,c,d) 
values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = insert into atacc1 ("........pg.dropped.1........") values (10);
 ERROR = !INSERT INTO: no such column 'atacc1.........pg.dropped.1........'
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = insert into atacc1 ("........pg.dropped.1........") values (default);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into atacc1 
("........pg.dropped.1........") values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = insert into atacc1 ("........pg.dropped.1........",b,c,d) values 
(10,11,12,13);
 ERROR = !INSERT INTO: no such column 'atacc1.........pg.dropped.1........'
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = insert into atacc1 ("........pg.dropped.1........",b,c,d) values 
(default,11,12,13);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into atacc1 
("........pg.dropped.1........",b,c,d) values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = delete from atacc1 where a = 3;
 ERROR = !SELECT: identifier 'a' unknown
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
@@ -588,8 +588,8 @@ QUERY = insert into c1 values(11,'xyz',3
 ERROR = !INSERT INTO: number of values doesn't match number of columns of 
table 'c1'
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = create domain mytype as text;
-ERROR = !syntax error, unexpected IDENT, expecting INDEX in: "create domain"
-MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = create temp table foo (f1 text, f2 mytype, f3 text);
 ERROR = !type (mytype) unknown in: "create temp table foo (f1 text, f2 mytype,"
         !syntax error, unexpected IDENT in: "f3"
@@ -605,22 +605,13 @@ ERROR = !syntax error, unexpected TYPE, 
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = alter table foo alter f1 TYPE varchar(10);
 ERROR = !syntax error, unexpected TYPE, expecting DROP or SET in: "alter table 
foo alter f1 type"
-MAPI  = (monetdb) /var/tmp/mtest-20743/.s.monetdb.31311
-QUERY = insert into anothertab (atcol1, atcol2) values (default, true);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into anothertab (atcol1, 
atcol2) values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
-QUERY = insert into anothertab (atcol1, atcol2) values (default, false);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into anothertab (atcol1, 
atcol2) values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = alter table anothertab alter column atcol1 type boolean; -- fails
 ERROR = !syntax error, unexpected TYPE, expecting DROP or SET in: "alter table 
anothertab alter column atcol1 type"
 MAPI  = (monetdb) /var/tmp/mtest-22572/.s.monetdb.35667
 QUERY = alter table anothertab alter column atcol1 type integer;
 ERROR = !syntax error, unexpected TYPE, expecting DROP or SET in: "alter table 
anothertab alter column atcol1 type"
-MAPI  = (monetdb) /var/tmp/mtest-20743/.s.monetdb.31311
-QUERY = insert into anothertab (atcol1, atcol2) values (default, null);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into anothertab (atcol1, 
atcol2) values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22684/.s.monetdb.37188
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = alter table anothertab alter column atcol2 type text
               using case when atcol2 is true then 'IT WAS TRUE' 
                          when atcol2 is false then 'IT WAS FALSE'
diff --git a/sql/test/pg_regress/Tests/alter_table.stable.out 
b/sql/test/pg_regress/Tests/alter_table.stable.out
--- a/sql/test/pg_regress/Tests/alter_table.stable.out
+++ b/sql/test/pg_regress/Tests/alter_table.stable.out
@@ -658,6 +658,10 @@ Ready.
 [ "zz",        "qq"    ]
 #drop table foo;
 #create table anothertab (atcol1 bigint GENERATED ALWAYS AS IDENTITY check 
(atcol1 <= 3), atcol2 boolean);
+#insert into anothertab (atcol1, atcol2) values (default, true);
+[ 1    ]
+#insert into anothertab (atcol1, atcol2) values (default, false);
+[ 1    ]
 #insert into anothertab (atcol2) values (true);
 [ 1    ]
 #insert into anothertab (atcol2) values (false);
@@ -669,6 +673,8 @@ Ready.
 % 1,   5 # length
 [ 1,   true    ]
 [ 2,   false   ]
+[ 3,   true    ]
+[ 4,   false   ]
 #select * from anothertab;
 % sys.anothertab,      sys.anothertab # table_name
 % atcol1,      atcol2 # name
@@ -676,8 +682,12 @@ Ready.
 % 1,   5 # length
 [ 1,   true    ]
 [ 2,   false   ]
+[ 3,   true    ]
+[ 4,   false   ]
 #insert into anothertab (atcol1, atcol2) values (45, null); -- fails
 [ 1    ]
+#insert into anothertab (atcol1, atcol2) values (default, null);
+[ 1    ]
 #insert into anothertab (atcol2) values (null);
 [ 1    ]
 #select * from anothertab;
@@ -687,8 +697,11 @@ Ready.
 % 2,   5 # length
 [ 1,   true    ]
 [ 2,   false   ]
+[ 3,   true    ]
+[ 4,   false   ]
 [ 45,  NULL    ]
-[ 3,   NULL    ]
+[ 5,   NULL    ]
+[ 6,   NULL    ]
 #select * from anothertab;
 % sys.anothertab,      sys.anothertab # table_name
 % atcol1,      atcol2 # name
@@ -696,8 +709,11 @@ Ready.
 % 2,   5 # length
 [ 1,   true    ]
 [ 2,   false   ]
+[ 3,   true    ]
+[ 4,   false   ]
 [ 45,  NULL    ]
-[ 3,   NULL    ]
+[ 5,   NULL    ]
+[ 6,   NULL    ]
 #alter table anothertab alter column atcol1 drop default;
 #select * from anothertab;
 % sys.anothertab,      sys.anothertab # table_name
@@ -706,8 +722,11 @@ Ready.
 % 2,   5 # length
 [ 1,   true    ]
 [ 2,   false   ]
+[ 3,   true    ]
+[ 4,   false   ]
 [ 45,  NULL    ]
-[ 3,   NULL    ]
+[ 5,   NULL    ]
+[ 6,   NULL    ]
 #drop table anothertab;
 #create table another (f1 int, f2 text);
 #insert into another values(1, 'one');
diff --git a/sql/test/pg_regress/Tests/insert.stable.err 
b/sql/test/pg_regress/Tests/insert.stable.err
--- a/sql/test/pg_regress/Tests/insert.stable.err
+++ b/sql/test/pg_regress/Tests/insert.stable.err
@@ -31,11 +31,11 @@ stderr of test 'insert` in directory 'sq
 
 MAPI  = (monetdb) /var/tmp/mtest-27483/.s.monetdb.35395
 QUERY = insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT, 
DEFAULT);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into inserttest (col1, 
col2, col3) values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22520/.s.monetdb.34322
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into inserttest (col1, 
col2, col3) values (default"
-MAPI  = (monetdb) /var/tmp/mtest-22520/.s.monetdb.34322
+
+MAPI  = (monetdb) /var/tmp/mtest-4014/.s.monetdb.32482
 QUERY = insert into inserttest (col1, col2, col3) values (1, 2);
 ERROR = !INSERT INTO: number of values doesn't match number of columns of 
table 'inserttest'
 MAPI  = (monetdb) /var/tmp/mtest-27483/.s.monetdb.35395
@@ -43,7 +43,6 @@ QUERY = insert into inserttest (col1) va
 ERROR = !INSERT INTO: number of values doesn't match number of columns of 
table 'inserttest'
 MAPI  = (monetdb) /var/tmp/mtest-27483/.s.monetdb.35395
 QUERY = insert into inserttest (col1) values (DEFAULT, DEFAULT);
-ERROR = !syntax error, unexpected DEFAULT in: "insert into inserttest (col1) 
values (default"
 
 
 # 17:11:19 >  
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to