File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,10 @@ std::string Expr_parser_base::parse_cast_type()
215
215
parse_error (" Expected cast type" );
216
216
217
217
Keyword::Type type = Keyword::get (*token);
218
+
219
+ if (Keyword::NONE == type)
220
+ parse_error (" Unexpected cast type" );
221
+
218
222
type_str = Keyword::name (type);
219
223
220
224
switch (type)
@@ -242,7 +246,7 @@ std::string Expr_parser_base::parse_cast_type()
242
246
break ;
243
247
244
248
default :
245
- parse_error (" Expected cast type" );
249
+ parse_error (" Unexpected cast type" );
246
250
247
251
}
248
252
@@ -1695,7 +1699,7 @@ Expression* Expr_parser_base::parse_ilri(Processor *prc)
1695
1699
switch (Keyword::get (*t))
1696
1700
{
1697
1701
case Keyword::L_TRUE: aprc->list_el ()->scalar ()->val ()->yesno (true ); break ;
1698
- case Keyword::L_FALSE: aprc->list_el ()->scalar ()->val ()->yesno (true ); break ;
1702
+ case Keyword::L_FALSE: aprc->list_el ()->scalar ()->val ()->yesno (false ); break ;
1699
1703
case Keyword::L_NULL: aprc->list_el ()->scalar ()->val ()->null (); break ;
1700
1704
default :
1701
1705
t = NULL ; // this indicates error
Original file line number Diff line number Diff line change @@ -641,5 +641,22 @@ TEST_F(Bugs, bug29525077)
641
641
}
642
642
}
643
643
sess.dropSchema (" bug29525077_int_types" );
644
+ }
644
645
645
- }
646
+ TEST_F (Bugs, is_false)
647
+ {
648
+ SKIP_IF_NO_XPLUGIN
649
+ auto schema = get_sess ().createSchema (" test" , true );
650
+ auto coll = schema.createCollection (" is_false" , true );
651
+ coll.remove (" true" ).execute ();
652
+ coll.add (DbDoc (R"( {"val": 0 })" )).execute ();
653
+ coll.add (DbDoc (R"( {"val": 1 })" )).execute ();
654
+ coll.add (DbDoc (R"( {"val": 1 })" )).execute ();
655
+ // Since boolean is not an expected type, it should throw error
656
+ // Had a segmentation fault issue
657
+ EXPECT_THROW (coll.find (" cast(val as boolean) is false" ).execute (),
658
+ mysqlx::Error);
659
+ EXPECT_EQ (1 , coll.find (" val is false" ).execute ().count ());
660
+ auto tbl = schema.getCollectionAsTable (" is_false" );
661
+ EXPECT_EQ (1 , tbl.select ().where (" doc->$.val is false" ).execute ().count ());
662
+ }
You can’t perform that action at this time.
0 commit comments