mariadb/mysql-test/suite/compat/oracle/r
Alexander Barkov f11504af51 MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR
This patch adds support for SYS_REFCURSOR (a weakly typed cursor)
for both sql_mode=ORACLE and sql_mode=DEFAULT.

Works as a regular stored routine variable, parameter and return value:

- can be passed as an IN parameter to stored functions and procedures
- can be passed as an INOUT and OUT parameter to stored procedures
- can be returned from a stored function

Note, strongly typed REF CURSOR will be added separately.

Note, to maintain dependencies easier, some parts of sql_class.h
and item.h were moved to new header files:

- select_results.h:
  class select_result_sink
  class select_result
  class select_result_interceptor

- sp_cursor.h:
  class sp_cursor_statistics
  class sp_cursor

- sp_rcontext_handler.h
  class Sp_rcontext_handler and its descendants

The implementation consists of the following parts:
- A new class sp_cursor_array deriving from Dynamic_array

- A new class Statement_rcontext which contains data shared
  between sub-statements of a compound statement.
  It has a member m_statement_cursors of the sp_cursor_array data type,
  as well as open cursor counter. THD inherits from Statement_rcontext.

- A new data type handler Type_handler_sys_refcursor in plugins/type_cursor/
  It is designed to store uint16 references -
  positions of the cursor in THD::m_statement_cursors.

- Type_handler_sys_refcursor suppresses some derived numeric features.
  When a SYS_REFCURSOR variable is used as an integer an error is raised.

- A new abstract class sp_instr_fetch_cursor. It's needed to share
  the common code between "OPEN cur" (for static cursors) and
  "OPER cur FOR stmt" (for SYS_REFCURSORs).

- New sp_instr classes:
  * sp_instr_copen_by_ref      - OPEN sys_ref_curor FOR stmt;
  * sp_instr_cfetch_by_ref     - FETCH sys_ref_cursor INTO targets;
  * sp_instr_cclose_by_ref     - CLOSE sys_ref_cursor;
  * sp_instr_destruct_variable - to destruct SYS_REFCURSOR variables when
                                 the execution goes out of the BEGIN..END block
                                 where SYS_REFCURSOR variables are declared.
- New methods in LEX:
  * sp_open_cursor_for_stmt   - handles "OPEN sys_ref_cursor FOR stmt".
  * sp_add_instr_fetch_cursor - "FETCH cur INTO targets" for both
                                static cursors and SYS_REFCURSORs.
  * sp_close - handles "CLOSE cur" both for static cursors and SYS_REFCURSORs.

- Changes in cursor functions to handle both static cursors and SYS_REFCURSORs:
  * Item_func_cursor_isopen
  * Item_func_cursor_found
  * Item_func_cursor_notfound
  * Item_func_cursor_rowcount

- A new system variable @@max_open_cursors - to limit the number
  of cursors (static and SYS_REFCURSORs) opened at the same time.
  Its allowed range is [0-65536], with 50 by default.

- A new virtual method Type_handler::can_return_bool() telling
  if calling item->val_bool() is allowed for Items of this data type,
  or if otherwise the "Illegal parameter for operation" error should be raised
  at fix_fields() time.

- New methods in Sp_rcontext_handler:
  * get_cursor()
  * get_cursor_by_ref()

- A new class Sp_rcontext_handler_statement to handle top level statement
  wide cursors which are shared by all substatements.

- A new virtual method expr_event_handler() in classes Item and Field.
  It's needed to close (and make available for a new OPEN)
  unused THD::m_statement_cursors elements which do not have any references
  any more. It can happen in various moments in time, e.g.
  * after evaluation parameters of an SQL routine
  * after assigning a cursor expression into a SYS_REFCURSOR variable
  * when leaving a BEGIN..END block with SYS_REFCURSOR variables
  * after setting OUT/INOUT routine actual parameters from formal
    parameters.
2025-04-19 10:59:58 +04:00
..
anonymous_derived.result MariaDB 11.4.4 release 2024-11-08 07:17:00 +01:00
binlog_ptr_mysqlbinlog.result MDEV-34504 PURGE BINARY LOGS not working anymore 2024-07-10 18:50:08 +03:00
binlog_stm_ps.result
binlog_stm_sp.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
binlog_stm_sp_package.result
column_compression.result Merge branch 'bb-11.5-release' into bb-11.6-release 2024-08-06 17:28:38 +02:00
custom_aggregate_functions.result MDEV-18813 PROCEDURE and anonymous blocks silently ignore FETCH GROUP NEXT ROW 2019-03-07 18:48:15 +04:00
empty_string_literal.result Merge 10.5 into 10.6 2024-03-27 15:00:56 +02:00
events.result fix tests for embedded 2022-05-18 01:22:29 +02:00
exception.result Update errmsg-utf8.txt re my_snprintf suffixes 2025-02-12 10:17:44 +01:00
func_add_months.result MDEV-20025: ADD_MONTHS() Oracle function 2021-05-19 22:54:12 +02:00
func_case.result
func_concat.result Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
func_decode.result MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
func_length.result
func_misc.result MDEV-34679 ER_BAD_FIELD uses non-localizable substrings 2024-10-17 21:37:37 +02:00
func_pad.result MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
func_qualified.result MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode 2024-01-24 10:59:17 +04:00
func_regexp_replace.result MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode 2024-01-24 10:59:17 +04:00
func_replace.result MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
func_substr.result MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
func_time.result
func_to_char.result MDEV-29152: Assertion failed ... upon TO_CHAR with wrong argument 2023-07-12 12:05:59 +03:00
func_trim.result MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
gis-debug.result MDEV-20009 Add CAST(expr AS pluggable_type) 2019-07-10 11:55:16 +04:00
gis.result MDEV-33803 Error 4162 "Operator does not exists" is incorrectly-worded 2024-04-03 10:03:02 +11:00
information_schema_parameters.result 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.result MDEV-17363 - Compressed columns cannot be restored from dump 2019-06-18 07:48:08 +04:00
lower_case_table_names.result MDEV-31340 Remove MY_COLLATION_HANDLER::strcasecmp() 2024-04-18 15:22:10 +04:00
minus.result MDEV-20021 sql_mode="oracle" does not support MINUS set operator 2021-05-19 22:54:12 +02:00
misc.result 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.result MDEV-17363 - Compressed columns cannot be restored from dump 2019-06-18 07:48:08 +04:00
mysqldump_restore_func_qualified.result Merge branch '11.4' into 11.7 2025-02-06 16:46:36 +01:00
parser.result MDEV-31616 Problems with a stored function EMPTY() on upgrade to 10.6. 2024-01-24 09:59:55 +04:00
plugin.result 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.result MDEV-34679 ER_BAD_FIELD uses non-localizable substrings 2024-10-17 21:37:37 +02:00
rpl_mariadb_date.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
rpl_sp_package.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
rpl_sp_package_variables.result
sequence.result
sp-anchor-row-type-table.result MDEV-12252 ROW data type for stored function return values 2024-10-21 07:59:29 +04:00
sp-anchor-type.result MDEV-12252 ROW data type for stored function return values 2024-10-21 07:59:29 +04:00
sp-anonymous.result
sp-code.result MDEV-10862: Stored procedures: default values for parameters (optional parameters) 2025-01-31 19:42:04 +04:00
sp-cursor-decl.result Merge 10.2 into 10.3 2020-04-15 09:56:03 +03:00
sp-cursor-rowtype.result MariaDB 11.4.4 release 2024-11-08 07:17:00 +01:00
sp-cursor.result MDEV-36047 Package body variables are not allowed as FETCH targets 2025-02-09 13:56:19 +04:00
sp-default-param.result MDEV-10862: Stored procedures: default values for parameters (optional parameters) 2025-01-31 19:42:04 +04:00
sp-expr.result
sp-goto-debug.result MDEV-20667 Server crash on pop_cursor 2019-12-12 16:25:16 +04:00
sp-goto.result MDEV-20667 Server crash on pop_cursor 2019-12-12 16:25:16 +04:00
sp-inout.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
sp-memory-leak.result 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.result MDEV-36047 Package body variables are not allowed as FETCH targets 2025-02-09 13:56:19 +04:00
sp-package-concurrent-dml-db.result
sp-package-concurrent-dml-package.result
sp-package-concurrent-dml-trigger.result
sp-package-concurrent-dml-view.result
sp-package-i_s.result 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.result Removed "<select expression> INTO <destination>" deprication. 2023-02-03 11:57:50 +03:00
sp-package-mdl.result Added new MDL_BACKUP locks for all backup stages 2018-12-09 22:12:27 +02:00
sp-package-mysqldump.result Merge branch 'bb-11.5-release' into bb-11.6-release 2024-08-06 17:28:38 +02:00
sp-package-security.result MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00
sp-package.result MDEV-36067 Assertion failure in TABLE_SHARE::init_from_sql_statement_string 2025-04-18 09:41:23 +02:00
sp-param.result MDEV-35229 NOCOPY has become reserved word bringing wide incompatibility 2024-10-30 13:58:20 +04:00
sp-record.result MDEV-34317: Implement RECORD type 2025-01-28 09:23:04 +04:00
sp-row.result MDEV-12252 ROW data type for stored function return values 2024-10-21 07:59:29 +04:00
sp-security.result MDEV-28548: ER_TABLEACCESS_DENIED_ERROR is missing information about DB 2022-09-30 08:48:57 +02:00
sp-sys_refcursor-alias.result MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR 2025-04-19 10:59:58 +04:00
sp-sys_refcursor-func_hybrid.result MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR 2025-04-19 10:59:58 +04:00
sp-sys_refcursor.result MDEV-20034 Add support for the pre-defined weak SYS_REFCURSOR 2025-04-19 10:59:58 +04:00
sp.result MDEV-12252 ROW data type for stored function return values 2024-10-21 07:59:29 +04:00
statement-expr.result MDEV-20634 Report disallowed subquery errors as such (instead of parse error) 2019-09-20 10:36:20 +04:00
table_value_constr.result Merge branch '10.11' into 11.2 2024-10-29 16:42:46 +01:00
trigger.result
truncate.result
type_blob.result MDEV-20263 sql_mode=ORACLE: BLOB(65535) should not translate to LONGBLOB 2019-08-06 18:02:03 +04:00
type_clob.result
type_date.result MDEV-12252 ROW data type for stored function return values 2024-10-21 07:59:29 +04:00
type_number.result
type_raw.result
type_varchar.result
type_varchar2.result
update.result MDEV-27769 Assertion failed in Field::ptr_in_record upon UPDATE in ORACLE mode 2025-01-26 16:15:46 +01:00
update_innodb.result Removed "<select expression> INTO <destination>" deprication. 2023-02-03 11:57:50 +03:00
variables.result
vcol.result
vcol_innodb.result MDEV-27744 LPAD in vcol created in ORACLE mode makes table corrupted in non-ORACLE 2023-11-08 15:01:20 +04:00
versioning.result 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.result