@@ -467,7 +467,7 @@ TEST_F(Sess, view)
467
467
468
468
sch.createView (view_name, false )
469
469
.security (mysqlx::SQLSecurity::DEFINER)
470
- .definer (" root" )
470
+ .definer (" root@localhost " )
471
471
.definedAs (tbl.select (" name as view_name" , " 2016-age as view_birth" ))
472
472
.withCheckOption (mysqlx::CheckOption::LOCAL)
473
473
.execute ();
@@ -515,7 +515,7 @@ TEST_F(Sess, view)
515
515
sch.alterView (view_name)
516
516
.columns (columns_list, " one" )
517
517
.security (mysqlx::SQLSecurity::DEFINER)
518
- .definer (" root" )
518
+ .definer (" root@localhost " )
519
519
.definedAs (tbl_select)
520
520
.withCheckOption (mysqlx::CheckOption::LOCAL)
521
521
.execute ()
@@ -524,7 +524,7 @@ TEST_F(Sess, view)
524
524
auto view_exec = sch.alterView (view_name)
525
525
.columns (columns_list, " one" , string (" two" ))
526
526
.security (mysqlx::SQLSecurity::DEFINER)
527
- .definer (" root" )
527
+ .definer (" root@localhost " )
528
528
.definedAs (tbl_select)
529
529
.withCheckOption (mysqlx::CheckOption::LOCAL);
530
530
@@ -554,7 +554,7 @@ TEST_F(Sess, view)
554
554
EXPECT_THROW ( sch.alterView (view_name2)
555
555
.columns (" view_name" , " fake" )
556
556
.security (mysqlx::SQLSecurity::DEFINER)
557
- .definer (" root" )
557
+ .definer (" root@localhost " )
558
558
.definedAs (tbl_select)
559
559
.withCheckOption (mysqlx::CheckOption::LOCAL)
560
560
.execute ()
@@ -621,6 +621,35 @@ TEST_F(Sess, view)
621
621
622
622
EXPECT_EQ (30 , row.get (1 ).get <int >());
623
623
624
+ }
625
+
626
+ {
627
+ sch.dropView (view_name).execute ();
628
+
629
+ sch.createView (view_name)
630
+ .algorithm (Algorithm::MERGE)
631
+ .security (SQLSecurity::INVOKER)
632
+ .definer (" unknownUser" )
633
+ .definedAs (tbl.select ())
634
+ .withCheckOption (mysqlx::CheckOption::CASCADED)
635
+ .execute ();
636
+
637
+ std::stringstream qry;
638
+
639
+ qry << " show create view " << schema_name << " ." << view_name;
640
+
641
+ SqlResult result = sql (qry.str ());
642
+
643
+ Row r = result.fetchOne ();
644
+ std::string data = (string)r[1 ];
645
+
646
+ cout << r[0 ] << " : " << data << endl;
647
+
648
+ EXPECT_TRUE (data.find (" MERGE" ) != std::string::npos);
649
+ EXPECT_TRUE (data.find (" INVOKER" ) != std::string::npos);
650
+ EXPECT_TRUE (data.find (" unknownUser" ) != std::string::npos);
651
+ EXPECT_TRUE (data.find (" CASCADED" ) != std::string::npos);
652
+
624
653
}
625
654
626
655
std::cout << " Drop view" << std::endl;
0 commit comments