mariadb/mysql-test/suite/compat/oracle/t
Aleksey Midenkov 10643cffe9 MDEV-37325 Incorrect results for INTERSECT ALL in ORACLE mode
Oracle mode has no priority between set-operators but the current
implementation with disable_index_if_needed() can not work with
arbitrary mix of distinct/non-distinct set-operators as the algorithm
is tied to the properly wrapped version of expression. Index can be
disabled only once and cannot be reenabled afterwards.

To adapt Oracle mode for the aforementioned implementation we
prioritize each set operator with parens in the order of
appearance. So the expression:

  S1 op1 S2 op2 S3 op3 S4

will be rewritten like this:

  (((S1 op1 S2) op2 S3) op3 S4).

The rewritten expression is valid for both Oracle and default mode and
renders the same result. Prioritizing is done with
create_priority_nest() but it was tweaked to work with derived to be
the first operand. Originally create_priority_nest() could wrap only
second operand, like this:

  S1 op1 S2 op2 S3 -> S1 op1 (S2 op2 S3).

Now this behaviour is kept by non-NULL attach_to argument. With NULL
attach_to argument it produces this transformation:

  S1 op1 S2 -> (S1 op1 S2), but to be strict it will look like this:
  SELECT .. FROM (S1 op1 S2).

This expression is treated as the first one in the select list, so
nothing to "attach to".

On importance of not making fake_select_lex after
create_priority_nest() in parsed_select_expr_start(). This will fail
nastily in Protocol::valid_handler() check in store_longlong() for
EXPLAIN. This happens because select_options are inherited from newly
made fake_select_lex but without SELECT_DESCRIBE flag which is meant
to be assigned by mysql_explain_union() but union_needs_tmp_table() is
false (because now top-level unit has no set-operator, it is just
select from derived), so SELECT_DESCRIBE assignment is
skipped. Depending on that flag send_result_set_metadata() is
conditionally executed in JOIN::exec_inner(). And originally it is
done via select_describe() branch for top-level select when there is
no set operator (it is select from derived as explained above), not
via direct send_result_set_metadata().

On IS_OR_WAS_ORACLE. Sql_mode_save_for_frm_handling removes MODE_ORACLE
when view is registered or opened. We cannot return it back as this
conflicts with MDEV-12478 (tested by compat/oracle.func_concat). So we
are temporarily adding WAS_ORACLE flag instead. WAS_MODE_ORACLE is for
testing both WAS_ORACLE and MODE_ORACLE simultaneously.
2025-12-23 14:02:55 +03:00
..
anonymous_derived.test MDEV-19162 anonymous derived tables part 2020-11-17 20:11:39 +01:00
binlog_ptr_mysqlbinlog-master.opt MDEV-23108: Point in time recovery of binary log fails when sql_mode=ORACLE 2020-07-22 11:34:50 +05:30
binlog_ptr_mysqlbinlog.test MDEV-23108: Point in time recovery of binary log fails when sql_mode=ORACLE 2020-07-22 11:34:50 +05:30
binlog_stm_ps.test MDEV-16095 Oracle-style placeholder inside GROUP BY..WITH ROLLUP breaks replication 2018-05-06 16:10:49 +04:00
binlog_stm_sp.test MDEV-16020 SP variables inside GROUP BY..WITH ROLLUP break replication 2018-04-27 22:11:18 +04:00
binlog_stm_sp_package.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
column_compression.test Fix test failures on s390x in test following main.column_compression_rpl 2024-01-12 17:22:08 +01:00
custom_aggregate_functions.test MDEV-18813 PROCEDURE and anonymous blocks silently ignore FETCH GROUP NEXT ROW 2019-03-07 18:48:15 +04:00
empty_string_literal.test MDEV-14013 : sql_mode=EMPTY_STRING_IS_NULL 2017-10-14 17:28:54 +04:00
events.test fix tests for embedded 2022-05-18 01:22:29 +02:00
exception.test MDEV-12088 sql_mode=ORACLE: Do not require BEGIN..END in multi-statement exception handlers in THEN clause 2017-04-05 15:02:57 +04:00
func_add_months.test MDEV-20025: ADD_MONTHS() Oracle function 2021-05-19 22:54:12 +02:00
func_case.test MDEV-10342 Providing compatibility for basic SQL built-in functions 2017-04-05 15:02:48 +04:00
func_concat.test MDEV-31910 ASAN memcpy-param-overlap upon CONCAT in ORACLE mode 2024-11-06 11:39:50 +04:00
func_decode.test MDEV-31184 Remove parser tokens DECODE_MARIADB_SYM and DECODE_ORACLE_SYM 2023-10-24 01:45:47 +04:00
func_length.test MDEV-12783 : sql_mode=ORACLE: Functions LENGTH() and LENGTHB() 2017-05-18 11:43:24 +02:00
func_misc.test MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions 2017-05-20 16:29:11 +04:00
func_pad.test MDEV-15739 sql_mode=ORACLE: Make LPAD and RPAD return NULL instead of empty string 2018-04-03 14:00:19 +04:00
func_qualified.test MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode 2024-01-24 10:59:17 +04:00
func_regexp_replace.test MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode 2024-01-24 10:59:17 +04:00
func_replace.test MDEV-13003 - Oracle compatibility : Replace function 2017-08-11 14:47:36 +04:00
func_substr.test MDEV-10574 / SUBSTR - sql_mode=Oracle: return null instead of empty string 2018-03-13 10:34:28 +01:00
func_time.test MDEV-16152 Expressions with INTERVAL return bad results in some cases 2018-05-14 11:36:22 +04:00
func_to_char.test MDEV-29152: Assertion failed ... upon TO_CHAR with wrong argument 2023-07-12 12:05:59 +03:00
func_trim.test MDEV-15664 : sql_mode=ORACLE: Make TRIM return NULL instead of empty string 2018-03-29 14:27:57 +04:00
gis-debug.test MDEV-20009 Add CAST(expr AS pluggable_type) 2019-07-10 11:55:16 +04:00
gis.test MDEV-20009 Add CAST(expr AS pluggable_type) 2019-07-10 11:55:16 +04:00
information_schema_parameters.test MDEV-18092 Query with the table I_S.PARAMETERS stop working after a package is created 2019-04-18 08:34:08 +04:00
keywords.test MDEV-17363 - Compressed columns cannot be restored from dump 2019-06-18 07:48:08 +04:00
minus.test MDEV-20021 sql_mode="oracle" does not support MINUS set operator 2021-05-19 22:54:12 +02:00
misc.test An additional patch for MDEV-27690 Crash on CHARACTER SET csname COLLATE DEFAULT in column definition 2022-04-14 12:22:28 +04:00
mysqldump_restore.test MDEV-17363 - Compressed columns cannot be restored from dump 2019-06-18 07:48:08 +04:00
mysqldump_restore_func_qualified.test MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
parser.test MDEV-16708: fix in test failures caused by missing warnings received in prepare response packet 2021-06-17 19:30:24 +02:00
plugin.test MDEV-18767 Port "MDEV-16294: INSTALL PLUGIN IF NOT EXISTS / UNINSTALL PLUGIN IF EXISTS" to sql_yacc_ora.yy 2019-02-28 07:17:47 +04:00
ps.test MDEV-20634 Report disallowed subquery errors as such (instead of parse error) 2019-09-20 10:36:20 +04:00
rpl_mariadb_date.test MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode 2020-08-01 07:43:50 +04:00
rpl_sp_package.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
rpl_sp_package_variables.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sequence.test MDEV-31003: Second execution for ps-protocol 2023-07-26 17:15:00 +07:00
sp-anchor-row-type-table.test MDEV-14139 Anchored data types for variables 2017-10-27 20:48:16 +04:00
sp-anonymous.test MDEV-10655 Anonymous blocks 2017-04-05 15:02:55 +04:00
sp-cache-invalidate.inc MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-code.test MDEV-19639 + MDEV-19640 fix + preparatory changes for WL#4179 2019-06-04 06:21:22 +04:00
sp-cursor-decl.test Fixing a few data type related problems: MDEV-12875, MDEV-12886, MDEV-12916 2017-05-25 15:15:39 +04:00
sp-cursor-rowtype.test MDEV-21998: Server crashes in st_select_lex::add_table_to_list upon mix of KILL and sequences 2020-07-28 08:23:57 +02:00
sp-cursor.test A clean-up for MDEV-10654 add support IN, OUT, INOUT parameter qualifiers for stored functions 2022-01-24 19:46:27 +04:00
sp-expr.test Adding more tests for IN/EXIST subqueries for better coverage 2018-04-20 23:15:27 +04:00
sp-goto-debug.test MDEV-20667 Server crash on pop_cursor 2019-12-12 16:25:16 +04:00
sp-goto.test MDEV-20667 Server crash on pop_cursor 2019-12-12 16:25:16 +04:00
sp-inout.test Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00
sp-memory-leak.test MDEV-26186 280 Bytes lost in mysys/array.c, mysys/hash.c, sql/sp.cc, sql/sp.cc, sql/item_create.cc, sql/item_create.cc, sql/sql_yacc.yy:10748 when using oracle sql_mode 2023-07-18 12:19:16 +04:00
sp-package-code.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-package-concurrent-dml-db.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-package-concurrent-dml-package.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-package-concurrent-dml-trigger.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-package-concurrent-dml-view.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-package-concurrent-dml.inc MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-package-i_s.test MDEV-30662 SQL/PL package body does not appear in I_S.ROUTINES.ROUTINE_DEFINITION 2023-07-14 13:26:26 +04:00
sp-package-innodb.test MDEV-16708: fix in test failures(added --enable_prepared_warnings/--disable_prepared_warnings) 2021-06-17 19:30:24 +02:00
sp-package-mdl.test MDEV-11952 Oracle-style packages: stage#5 2018-02-27 15:26:51 +04:00
sp-package-mysqldump.test Merge branch '10.2' into 10.3 2019-09-03 13:17:32 +03:00
sp-package-security.test Merge branch '10.2' into 10.3 2019-09-03 13:17:32 +03:00
sp-package.test Merge branch '10.5' into 10.6 2023-08-01 15:08:52 +02:00
sp-param.inc MDEV-10596 Allow VARCHAR and VARCHAR2 without length as a data type of routine parameters and in RETURN clause 2017-04-05 15:02:49 +04:00
sp-param.test Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext 2017-10-30 16:42:46 +04:00
sp-row-vs-var.inc MDEV-10914 ROW data type for stored routine variables 2017-04-05 15:02:56 +04:00
sp-row.test MDEV-29356 Assertion `0' failed in Type_handler_row::Item_save_in_field on INSERT 2022-08-26 14:25:04 +04:00
sp-security.test MDEV-12133 sql_mode=ORACLE: table%ROWTYPE in variable declarations 2017-04-05 15:02:59 +04:00
sp.test Merge branch '10.4' into 10.5 2022-05-18 09:50:26 +02:00
statement-expr.test MDEV-20634 Report disallowed subquery errors as such (instead of parse error) 2019-09-20 10:36:20 +04:00
table_value_constr.test MDEV-37325 Incorrect results for INTERSECT ALL in ORACLE mode 2025-12-23 14:02:55 +03:00
trigger.test MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarations 2017-04-05 15:02:54 +04:00
truncate.test MDEV-10588 sql_mode=ORACLE: TRUNCATE TABLE t1 [ {DROP|REUSE} STORAGE ] 2017-04-05 15:02:54 +04:00
type_blob.test MDEV-20263 sql_mode=ORACLE: BLOB(65535) should not translate to LONGBLOB 2019-08-06 18:02:03 +04:00
type_clob.test MDEV-10343 Providing compatibility for basic SQL data types 2017-04-05 15:02:38 +04:00
type_date.test Merge branch '10.4' into 10.5 2020-08-04 17:24:15 +02:00
type_number.test MDEV-10343 Providing compatibility for basic SQL data types 2017-04-05 15:02:38 +04:00
type_raw.test MDEV-10343 Providing compatibility for basic SQL data types 2017-04-05 15:02:38 +04:00
type_varchar.test MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N)) 2017-04-05 15:02:54 +04:00
type_varchar2.test MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N)) 2017-04-05 15:02:54 +04:00
update.test MDEV-27769 Assertion failed in Field::ptr_in_record upon UPDATE in ORACLE mode 2025-01-26 16:15:46 +01:00
update_innodb.test Merge 10.5 into 10.6 2024-10-03 09:31:39 +03:00
variables.test A fix for MDEV-10411 Providing compatibility for basic PL/SQL constructs (Part 6: Assignment operator) 2017-04-05 15:02:52 +04:00
vcol.test MDEV-13500 sql_mode=ORACLE: can't create a virtual column with function MOD 2017-08-14 11:12:17 +04:00
vcol_innodb.test MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
versioning.test MDEV-17959 Assertion `opt_bootstrap || mysql_parse_status || thd->lex->select_stack_top == 0' failed in parse_sql upon DELETE HISTORY under ORACLE mode 2018-12-27 10:32:33 +04:00
win.test Adding "SET sql_mode=ORACLE" forgotten in fdcc95143d 2018-05-18 06:51:21 +04:00