diff --git a/contrib/dolphin/expected/operator_associativity.out b/contrib/dolphin/expected/operator_associativity.out new file mode 100644 index 0000000000000000000000000000000000000000..413cdb43c63af5c4769ef419f1638714db96734a --- /dev/null +++ b/contrib/dolphin/expected/operator_associativity.out @@ -0,0 +1,107 @@ +create table test_op_associativity(a int); +insert into test_op_associativity values (12); +insert into test_op_associativity values (12); +set dolphin.sql_mode = ''; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + a +---- + 12 + 12 +(2 rows) + +set dolphin.sql_mode = 'pipes_as_concat'; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + a +--- +(0 rows) + +select 1 < 2 < 3; + ?column? +---------- + t +(1 row) + +select 2 < 1 < 3; + ?column? +---------- + t +(1 row) + +select 2 < (1 < 3); + ?column? +---------- + f +(1 row) + +select 3 > 2 > 1; + ?column? +---------- + f +(1 row) + +select -2 > -3 > 0; + ?column? +---------- + t +(1 row) + +select -2 > (-3 > 0); + ?column? +---------- + f +(1 row) + +select 1 <= 2 <= 2; + ?column? +---------- + t +(1 row) + +select 2 <= 1 <= 2; + ?column? +---------- + t +(1 row) + +select 2 <= (1 <= 2); + ?column? +---------- + f +(1 row) + +select 3 >= 2 >= 1; + ?column? +---------- + t +(1 row) + +select -2 >= -3 >= 0; + ?column? +---------- + t +(1 row) + +select -2 >= (-3 >= 0); + ?column? +---------- + f +(1 row) + +select 1 != 1 != 1; + ?column? +---------- + t +(1 row) + +select 1 != 0 != 1; + ?column? +---------- + f +(1 row) + +select 2 != 1 != 0; + ?column? +---------- + t +(1 row) + diff --git a/contrib/dolphin/parallel_schedule_dolphin b/contrib/dolphin/parallel_schedule_dolphin index 5e4b7dd3d20a9e81be5a00bea77c7b0684190506..11be232b3dcd8c1cf5ab35eff4e5a4f83e5bb7b1 100644 --- a/contrib/dolphin/parallel_schedule_dolphin +++ b/contrib/dolphin/parallel_schedule_dolphin @@ -140,7 +140,7 @@ test: test_uuid_short test_sleep distinct dual_test fulltext_index test_text2boo test: operator_compatibility_test/numeric_operator_test_normal operator_compatibility_test/numeric_operator_test_min operator_compatibility_test/numeric_operator_test_max operator_compatibility_test/time_operator_test operator_compatibility_test/string_operator_test operator_compatibility_test/multi_type_operator_test -test: test_show_status pad_char_to_full_length timestamp_test test_mediumtext ai sqlmode_strict +test: test_show_status pad_char_to_full_length timestamp_test test_mediumtext ai sqlmode_strict operator_associativity # lock tables test: lock_tables lock_tables_1 diff --git a/contrib/dolphin/plugin_parser/gram.y b/contrib/dolphin/plugin_parser/gram.y index 7927cfbbf8025c518e5f2d4e8ddbdb8650eb3407..dd804498eac4f8a937b8f76513594bf3a194853c 100644 --- a/contrib/dolphin/plugin_parser/gram.y +++ b/contrib/dolphin/plugin_parser/gram.y @@ -1291,7 +1291,8 @@ static inline void ChangeBpcharCastType(TypeName* typname); %left AND %right NOT %right '=' CmpNullOp COLON_EQUALS -%nonassoc '<' '>' CmpOp BINARY +%left '<' '>' CmpOp +%nonassoc BINARY %nonassoc LIKE ILIKE SIMILAR SOUNDS NOT_LIKE NOT_ILIKE NOT_SIMILAR %nonassoc ESCAPE %nonassoc OVERLAPS diff --git a/contrib/dolphin/sql/operator_associativity.sql b/contrib/dolphin/sql/operator_associativity.sql new file mode 100644 index 0000000000000000000000000000000000000000..a055636b14d23c72f2cc0ec2200fe2f6f7b5ce5d --- /dev/null +++ b/contrib/dolphin/sql/operator_associativity.sql @@ -0,0 +1,29 @@ +create table test_op_associativity(a int); +insert into test_op_associativity values (12); +insert into test_op_associativity values (12); + +set dolphin.sql_mode = ''; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + +set dolphin.sql_mode = 'pipes_as_concat'; +select * from test_op_associativity where (length(a) > 1 || length(a) >1); + +select 1 < 2 < 3; +select 2 < 1 < 3; +select 2 < (1 < 3); + +select 3 > 2 > 1; +select -2 > -3 > 0; +select -2 > (-3 > 0); + +select 1 <= 2 <= 2; +select 2 <= 1 <= 2; +select 2 <= (1 <= 2); + +select 3 >= 2 >= 1; +select -2 >= -3 >= 0; +select -2 >= (-3 >= 0); + +select 1 != 1 != 1; +select 1 != 0 != 1; +select 2 != 1 != 0;