1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Commit Graph

1965 Commits

Author SHA1 Message Date
Vladislav Vaintroub
934108aab5 MDEV-14443 DENY statement
Implements DENY/REVOKE DENY and associated tasks.
2026-07-20 13:23:00 +03:00
Sergei Golubchik
0350ad8cb0 MDEV-30041 don't set utf8_is_utf8mb3 by default in the old-mode 2026-07-10 14:43:05 +02:00
Sergei Golubchik
fd8cec54af MDEV-35254 post-review fixes
* reduced PARSEC_ITERATIONS_MAX because PKCS5_PBKDF2_HMAC() takes
  a signed int
* instead of checking for '0'..'L' range (which includes punctuation,
  check for the valid result of base62_to_uchar()
* add a connection test with non-default parsec_iterations
* make parsec_iterations a normal command line option
* update C/C to allow larger number of iterations in the client parsec
2026-07-06 13:44:56 +02:00
Dearsh Oberoi
5ee48be418 MDEV-35254 Make iterations count configurable in PARSEC plugin
This patch adds a global and session level plugin variable
parsec_iterations to define the number of iterations to be
used when generating the key corresponding to the password.
It has a default value, lower and upper bounds.
2026-07-06 13:44:56 +02:00
forkfun
5ce03b5806 Merge branch '12.3' into '13.0' 2026-06-24 17:31:40 +02:00
forkfun
3170875cb6 Merge branch '11.8' into '12.3' 2026-06-24 12:27:13 +02:00
forkfun
867d16cea7 Merge branch '11.4' into '11.8' 2026-06-23 12:52:39 +02:00
Sergei Golubchik
0bf0e13a22 MDEV-40058 cached_sha2_password crashes on zero-length password
valid encrypted password cannot have zero length and must end with '\0'
2026-06-17 16:46:39 +02:00
Oleksandr Byelkin
9f98f82b14 Merge branch '11.8' into 12.3 2026-05-26 21:15:58 +02:00
Oleksandr Byelkin
e3d0d66f5b Merge branch 'bb-12.3-release' into bb-13.0-release 2026-05-26 20:40:49 +02:00
Oleksandr Byelkin
fc65e7e12a Merge branch 'bb-11.8-release' into bb-12.3-release 2026-05-26 20:40:41 +02:00
Sergei Golubchik
46a8eb42a5 fix plugins.feedback_os_release failure on sles-1600
just the comment at the beginning of its /etc/os-release
is already more than 256 bytes
2026-05-24 11:53:55 +02:00
Oleksandr Byelkin
f572addcc1 Merge branch '12.3' into 13.0 2026-05-22 09:52:05 +02:00
Oleksandr Byelkin
3f388a1cce Merge branch '11.8' into 12.3 2026-05-22 09:27:18 +02:00
Alexey Botchkov
6b79d98fc0 MDEV-39653 AddressSanitizer: heap-use-after-free in my_mb_wc_latin1/../Field_xmltype::store after invalid xml.
The Field_blob::store can affect the 'from' argument so it can't be used
after it.
2026-05-20 10:25:47 +04:00
Alexey Botchkov
6e20438a1c MDEV-39599 AddressSanitizer: heap-use-after-free in escape_string_for_mysql after sp with invalid xml (xmltype)).
Test case added.
2026-05-16 11:18:56 +04:00
Alexey Botchkov
c9421c80ff MDEV-39592 ALTER.. with xmltype silently overwrites row with prior rows data.
tests added.
2026-05-15 23:50:27 +04:00
Alexey Botchkov
6dcd3c9dc0 MDEV-39589 Wrong results with xmltype as a virtual column.
Store value in the XML column even if an error happened.
2026-05-15 20:00:01 +04:00
Alexey Botchkov
2c7c7e1216 MDEV-39573 Server crashes in Item_char_typecast::fix_length_and_dec_internal after select xmltype.
Charset specified for XMLTYPE constructor.
Error returned if XML is in UTF16/UTF32 as we can't parse it yet.
XML check added so only well-formed allowed.
2026-05-15 17:02:33 +04:00
Alexey Botchkov
49b2fd7f9e MDEV-39575 Protocol::end_statement(): Assertion `0' failed after insert into xmltype union of valid and invalid xml.
Field_xmltype::store has to do the my_error when it gets invalid XML,
  just the warning with the -1 return results in the DBUG_ASSERT.

Also the UpdateXML function result reverted back to the STRING as
it can legally produce invalid XML, so we can't have columns built
from the UpdateXML to be XMLTYPE.
2026-05-15 13:46:27 +04:00
Alexey Botchkov
66632eb126 MDEV-39570 LeakSanitizer: detected memory leaks after insert with xmltype
XML parser should always be freed.
2026-05-13 14:49:09 +04:00
Alexey Botchkov
181f13ec49 MDEV-39536 ASAN heap-buffer-overflow in process_str_arg upon ER_TRUNCATED_WRONG_VALUE "Incorrect XML value".
XML should be prepared before inserting it into the error message.
2026-05-10 14:29:02 +04:00
Alexey Botchkov
4c371e30f0 MDEV-38809 RBR fails upon DML with XML type.
Add Field_xmltype::rpl_conv_type_from() function to control
replication data types.
2026-05-08 14:09:25 +04:00
Oleksandr Byelkin
9cb70f0220 Merge branch '11.4' into 11.8 2026-05-08 08:11:03 +02:00
Oleksandr Byelkin
7598e4e95d Merge branch '10.11' into 11.4 2026-05-08 08:00:01 +02:00
Alexander Barkov
96b3dd0c34 MDEV-39546 Unclear error message on OPEN strict_cursor FOR 'stmt'
This statement:
  OPEN strict_cursor_variable FOR 'SELECT ...';
caused an unclear error message:

ERROR 4078: Illegal parameter data types row<2> and row<0> for operation 'OPEN..FOR'

Fixing the error to be clearer:
ERROR HY000: Incorrect usage of c0 and OPEN..FOR <dynamic string>

Note, this statement is not supported:
  OPEN strict_cursor_variable FOR 'SELECT ...';

It can be rewritten:
- either to use a SELECT statement instead of the dynamic string:
    OPEN strict_cursor_variable FOR SELECT ...;
- or to make c0 a weak cursor variable (i.e.without the RETURN clause)
    OPEN weak_cursor_variable FOR 'SELECT ...';
2026-05-07 16:26:18 +04:00
Yuchen Pei
fd93184bc2 MDEV-38752 Check that virtual column is a supertype to its expression before substitution
New optimizations were introduced that substitute virtual column
expressions (abbr. vcol expr) with index virtual columns (abbr. vcol
field) in ORDER BY and GROUP BY.

In this patch we introduce checks that the type of a vcol field is the
supertype to its vcol expr, and if not, do not proceed the
optimization. This ensures that the substitution is safe and does not
for example lose information due to truncation.

For simplicity, the version of the check implemented is strict with
100% precision, meaning that there are instances where vcol field is a
supertype to vcol expr, but the check returns false.

Type not covered in tests: Type_handler_null

Thanks to Jarir Khan <kjarir23@gmail.com> for initial patches
addressing this issue.
2026-05-06 11:35:09 +10:00
Marko Mäkelä
e13d89949c Merge 12.3 into main 2026-05-05 13:14:42 +03:00
Daniel Black
7efbb0d0b2 MDEV-38913: pam_mariadb_mtr.so installation path change
This reverts the effect of MDEV-21654 and includes
pam_mariadb_mtr in the mariadb-test-data Deb package.

This allows our CI systems to run tests on the
pam implementation on Debian systems.

As the pam configuration can include a full path,
we've change the installation of the pam module
pam_mariadb_mtr.so to under the /usr/lib*/plugins/test_pam_modules
directory and configured the pam configuration file,
suite/plugins/pam/mariadb_mtr, to include the
full path to pam_mariadb_mtr.so.
2026-05-03 19:17:17 +10:00
Sergei Golubchik
26606cefdc MDEV-39141 MariaDB crashes in THD::THD() due to misalignment
fix alloc_root() and my_malloc() to return 16-aligned pointers

(type_assoc_array.sp-assoc-array-64bit prints changes in memory_used,
and my_malloc() uses more memory now)
2026-04-30 21:55:42 +02:00
Sergei Golubchik
e1c2bb860a bump the maturity of caching_sha2_password and parsec plugins 2026-04-30 09:48:04 +02:00
Alexey Botchkov
2ed8c4c812 MDEV-39124 XMLTYPE: allow only well-formed XML.
Necessary checks added to the XMLTYPE.
2026-04-29 14:38:18 +04:00
Sergei Golubchik
f34afeaf6b MDEV-39318 MTR: fix test failures when running with --ssl
make sure P_S.{global|session}_status and I_S.feedback plugin table
have a column of the same width as I_S.global_status.

Otherwise long status strings (e.g. Ssl_cipher_list) won't fit
and trigger a data truncation warning (an error in the strict mode)
2026-04-28 16:05:51 +02:00
Anway Durge
a96ebfcb2a MDEV-39126: Feedback plugin to use /etc/os-release
Update prepare_linux_info() to use /etc/os-release
(PRETTY_NAME) as the primary source for OS detection.

Retain fallback support for /etc/lsb-release and
/etc/*-release for older systems.

Add MTR regression test feedback_os_release.

Signed-off-by: Anway Durge <124391429+itzanway@users.noreply.github.com>
2026-04-22 09:20:15 +10:00
Alexey Botchkov
5d234b2aa8 MDEV-38767 XML datatype to be reported as format in extended metadata in protocol.
add respective Send_field metadata for UDT.
2026-04-21 10:13:04 +04:00
Mikhail Pochatkin
cbcff6324a MDEV-39173 Replace sprintf with snprintf, remove deprecated pragma
Remove the unscoped #pragma GCC diagnostic ignored
"-Wdeprecated-declarations" from include/violite.h and replace all
sprintf/vsprintf calls with snprintf/vsnprintf across the codebase.

Where possible, pass actual buffer sizes as function parameters
instead of using hardcoded constants or recomputing strlen().
Notable API changes:
- get_date(): added to_len parameter for buffer size
- nice_time(), end_timer() in client/mysql.cc: added buff_size
- generate_new_name(): added name_size parameter
- calc_md5(): added buffer_size parameter (fixes off-by-one)
- MD5_HASH_TO_STRING macro: added _size parameter
- Added MYSQL_UDF_MAX_RESULT_LENGTH constant in mysql_com.h

Also fixed a pre-existing bug in sql/rpl_mi.cc where the ellipsis
"..." was written to the wrong buffer (dbuff instead of buff).

Vendored code is excluded: extra/readline, extra/wolfssl,
wsrep-lib, libmariadb, storage/mroonga/vendor, zlib.
2026-04-16 19:00:12 +10:00
HNOONa-0
30beca72c8 MDEV-35369: Add IS_DEPRECATED to SYSTEM_VARIABLES
- Add IS_DEPRECATED and DEPRECATION_REPLACEMENT columns to the
  SYSTEM_VARIABLES information schema table
- Add a mysql-test case to verify the new columns output correctly
2026-04-15 21:10:03 +05:30
Abhishek Bansal
8f17bd8765 MDEV-36444: Support for user-defined field and index options 2026-04-15 11:55:55 +02:00
Abhishek Bansal
57e5d789b1 MDEV-18386: Add server_audit_timestamp_format to customize audit log timestamps 2026-04-13 21:25:08 +02:00
Alexander Barkov
90f8178f33 MDEV-10152 Add support for TYPE .. IS REF CURSOR
Adding support for the strict cursor data types:

Example 1a:
  TYPE rec0_t IS RECORD (a INT, VARCHAR(10));
  TYPE cur0_t IS REF CURSOR RETURN rec0_t;

Example 1b:
  TYPE rec0_t IS RECORD (a t1.a%TYPE, b t1.b%TYPE);
  TYPE cur0_t IS REF CURSOR RETURN rec0_t;

Example 1c:
  TYPE rec0_t IS RECORD (a INT, VARCHAR(10));
  r0 rec0_t;
  TYPE cur0_t IS REF CURSOR RETURN r0%TYPE;

Example 1d:
  TYPE rec0_t IS RECORD (a t1.a%TYPE, b t1.b%TYPE);
  r0 rec0_t;
  TYPE cur0_t IS REF CURSOR RETURN r0%TYPE;

Example2a:
  TYPE cur0_t IS REF CURSOR RETURN t1%ROWTYPE; -- t1 is a table

Example 2b:
  r0 t1%ROWTYPE;
  TYPE cur0_t IS REF CURSOR RETURN r0%TYPE;

Example3a:
  CURSOR cursor_sample IS SELECT a,b FROM t1;
  TYPE cur0_t IS REF CURSOR RETURN cursor_sample%ROWTYPE;

Example3b:
  CURSOR cursor_sample IS SELECT a,b FROM t1;
  r0 cursor_sample%ROWTYPE;
  TYPE cur0_t IS REF CURSOR RETURN r0%TYPE;

If a cursor variable is declared with a RETURN clause then:
1. At OPEN type the data type of the SELECT list row is compared
  for compatibility with the cursor RETURN data type.
  The SELECT list row must be assignable to the RETURN type row.
  If case if assignability is not meet, an error is raised
  Assignability means:
  - The arity of the SELECT list must be equal to the arity
    of the RETURN clause
  - Every n-th field of the SELECT list must be assignable to the
    n-th field of the RETURN Clause

2. At FETCH time, the data is fetched in two steps:
  a. On the first step the data is fetched into a virtual table
     with the row type described in the RETURN clause
  b. On the second step the data is copied from the virtual table
     to the target fetch list. Data type conversion can happen
     on this step.

Change details:

Adding new methods:
- sp_cursor::check_assignability_to
- Virtual_tmp_table::check_assignability_from
- Virtual_tmp_table::sp_set_from_select_list
- Virtual_tmp_table::sp_save_in_vtable
- Virtual_tmp_table::sp_save_in_target_list
- LEX::check_ref_cursor_components
- LEX::make_sp_instr_copy_struct_for_last_context_variables
- LEX::declare_type_ref_cursor
- sp_cursor::Select_fetch_into_spvars::send_data_with_return_type

Adding new members:
- sp_instr_copen_by_ref::m_cursor_name
- Select_fetch_into_spvars::m_return_type
- Select_materialize::m_cursor_name
- Select_materialize::m_return_type

Adding new virtual methods:
- Item::resolve_spvar_cursor_rowtype
- Type_handler::Spvar_definition_resolve_type_refs
- Server_side_cursor::check_assignability_to
- Overriding Select_materialize::prepare to raise an error when the cursor
  returned data type is not compatible with the RETURN clause

Making these methods virtual:
- Field::check_assignability_from

Adding new classes:
- sp_type_def_ref
- RowTypeBuffer

Adding new constructors to:
- Spvar_definition

Adding new helper methods (e.g. to reuse the code)
- Field::store_field_maybe_null
- ChanBuffer::append_ulonglong
- sp_pcontext::set_type_for_last_context_variables

Minor changes:
- Making TABLE::export_structure const
- Overriding Item_splocal::type_extra_attributes. It was forgotten in earlier changes.

Adding new error messages
- ER_CANNOT_CAST_ON_IDENT1_ASSIGNMENT_FOR_OPERATION
- ER_CANNOT_CAST_ON_IDENT2_ASSIGNMENT_FOR_OPERATION
2026-04-06 15:16:38 +04:00
Alexander Barkov
bfcb303c05 MDEV-38871 Variable declarations accept unexpected data type attributes (lengh,dec,srid)
Some data types:
- RECORD
- assoc arrays
- SYS_REFCURSOR

erroneously accepted non-relevant attributes:
- length
- scale
- character set / collation
- REF_SYSTEM_ID

Fixing to raise an error.

Details:

- Overriding get_column_attributes() in Type_handler_row,
  Type_handler_sys_refcursor, Type_handler_assoc_array.

- Moving a piece of the old code into a new method
  Type_handler::check_data_type_attributes(), to reuse it
  for testing attributes for both plugin types and TYPE-def types.

- Reusing check_data_type_attributes() in methods
  * LEX::set_field_type_udt_or_typedef()
  * LEX::set_field_type_udt()

- Adding opt_binary into the rule field_type_all_with_typedefs,
  into the grammar branch for the plugin types, as XMLTYPE needs it.
2026-04-06 15:00:16 +04:00
Alexander Barkov
4b376f58a1 MDEV-38768 RECORD in routine parameters and function RETURN
- Allowing types declared by the TYPE declarations in the grammar
  for stored routine parameters and stored function RETURN clause.

- Overriding Type_handler_row::Column_definition_prepare_stage1()
  to copy the record structure from get_attr_const_generic_ptr(0)
  into Spvar_definition::m_row_field_definition.
  This makes TYPE..IS RECORD types work as routine parameters and RETURN.

- Raising an error when type==COLUMN_DEFINITION_ROUTINE_PARAM or
  type==COLUMN_DEFINITION_FUNCTION_RETURN is passed to
  Type_handler_assoc_array::Column_definition_set_attributes().
  The underlying assoc array code is not ready to support
  parameters and RETURN. It will be done separately.

- Adding tests

- Some changes has changed the error from ER_NOT_ALLOWED_IN_THIS_CONTEXT
  to ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION. This is ok, as the latter
  is more informative.
2026-04-06 15:00:16 +04:00
Alexander Barkov
e581d1b5e0 MDEV-38436 Remove Type_handler::Column_definition_fix_attributes()
The method Type_handler::Column_definition_fix_attributes() was an
addition for Type_handler::Column_definition_set_attributes().

The code in virtual implementations of Column_definition_fix_attributes()
has now been joined to corresponding virtual implementations of
Column_definition_set_attributes().

After this change everything is done in Column_definition_set_attributes().

This makes the code clearer. Previous implementation was rather confusing.
For example, for temporal data types:
(1) After Column_definition_set_attributes():
  - Column_definition::length meant the fractional precision
  - Column_definition::decimals was set to 0
(2) After Column_definition_fix_attributes():
  - Column_definition::length means the full character length
  - Column_definition::decimals means the fractional precision

Now everything gets set to (2) right in Column_definition_set_attributes().
2026-04-06 15:00:16 +04:00
Alexander Barkov
97d2b7198c MDEV-38161 Refactor Type_extra_attributes: change void* for generic attributes to a better type
The first key point of this commit is changing Type_extra_attributes in the way
that the pointer to a generic attribute is now "Type_generic_attributes*" -
a pointer to a new class with vitrual method type_handler().

Before this change the pointer to a generic attribute was
"void *m_attr_const_void_ptr", which was error prone, as allowed
to pass a pointer to a wrong structure without control.

Another key point is that the SET/ENUM data type related structures
are now attributed by the changed class Type_typelib_attributes,
which now looks as follows:

  class Type_typelib_attributes: public Sql_alloc,
                                 public Type_generic_attributes,
                                 public TYPELIB

(with virtual method type_handler()), instead of being attributed by
TYPELIB directly.

Details:

- Using Column_definition's method typelib() where the member m_typelib
  was used directly. The related lines change anyway, because the member
  is renamed m_typelib_attr.

- Adding a new class Type_generic_attributes.
  Deriving the following classes from it:
  * Type_typelib_attributes
  * sp_type_def

- sp_type_def does not derive from Type_handler_hybrid_field_type any more,
  because the method type_handler() is now implemented virtually.

- Removing Type_extra_attributes::m_attr_const_void_ptr and
  adding Type_extra_attributes::m_attr_const_generic_attributes_ptr instead -
  a pointer to the new class Type_generic_attributes.
  Renaming methods to set and read it according to the new data type name.

- Type_typelib_attributes now derives from TYPELIB instead of having
  a pointer to TYPELIB.

- Adding a new class Type_typelib_ptr_attributes. It's a replacement for
  the old implementation of Type_typelib_attributes.

  Instead of deriving from Type_typelib_attributes, Field_enum now derives
  from Type_typelib_ptr_attributes. The latter can store/read itself into/from
  Type_extra_attributes. It's a bridge between the new Type_typelib_attributes
  and Type_extra_attributes.

- Changing parameter data type in a few methods in Field_enum from
  a pointer to TYPELIB to a pointer to Type_typelib_attributes.

- Removing typelib related methods from Type_extra_attributes.
  Moving this functionality into Type_typelib_ptr_attributes and
  Column_definition_attributes.
  This turns Type_extra_attributes into a data structure independent
  from any data type specific structures/methods.

- Adding methods:
   Column_definition_attributes::typelib_attr() - Column_definition derives it
   Column_definition_attributes::typelib()      - Column_definition derives it
   Type_typelib_ptr_attributes::typelib_attr()  - Field_enum derives it
   Type_typelib_ptr_attributes::typelib()       - Field_enum derives it

- Renaming the member Create_field::save_interval into
  Create_field::save_typelib_attr.
  Changing its data type from a pointer to TYPELIB into a pointer
  to Type_typelib_attributes pointer.

- Removing the method Type_typelib_attributes::store().
  Adding Type_typelib_ptr_attributes::save_in_type_extra_attributes() instead.
  The new method name makes the code more readable.
2026-04-06 15:00:16 +04:00
Alexander Barkov
ef8e462dcc MDEV-38162 Refactoring: Change sp_type_def_composite2::m_def from Spvar_definition* to Spvar_definition
- Changing sp_type_def_composite2::m_def from  Spvar_definition* to Spvar_definition.
- Encapsulating it.

Retionale:

1. sp_type_def_composite2 was allocated in two steps:
   a. An sp_type_def_composite2 instance itself was allocated
   b. Two instances of Spvar_definition were allocated immediately after,
       and assigned to m_def[0] and m_def[1] respectively.
   Such two step allocation was not really needed.
   So this change moves the two instances of Spvar_definition right
   inside sp_type_def_composite2, so now it gets allocated in a single "new"
   instead of three "new" calls.

2. In the upcoming REF CURSOR change, sp_type_def_ref has an
   Spvar_definition member inside it (not a pointer to it).
   It's better to have sp_type_def_composite2 and sp_type_def_ref
   look closer to each other.
2026-04-06 15:00:15 +04:00
Marko Mäkelä
55b3dced05 Merge 11.8 into 12.3 2026-04-02 09:15:17 +03:00
Bill Jin
9fc925d771 MDEV-35461 Remove redundant checks for standard library functions
Remove function checks that are guaranteed by C89/C99 standards to
reduce the excessive time spent during CMake configuration step. Also,
clean up related compatibility code.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
2026-04-02 10:36:09 +11:00
Tuukka Pasanen
a103be381b MDEV-30953: Add package for Galera server for RPM
Following the previous commit, we apply the same
to RPM.

Add new package Mariadb-server-galera to RPM build
recude mariadb-server package dependencies.
Galera cluster scripts and libraries are currently
in package mariadb-server. Move Galera cluster
scripts and libraries to new package mariadb-server-galera
as most of the people does not need them and
it allows to slim down mariadb-server package

The MariaDB-test package unlike its Debian
equal, didn't depend on the MariaDB-server
(and now it does), except if WITH_WSREP is
specified in which case it depends on the
MariaDB-server-galera package

Also from a865a7c23b
lsof, socat and pv are RECOMMENDS.
* lsof/socat - when selinux is enabled, these aren't used
* pv - the galera sst scripts will silently ignore its absence

Updated/Edited by: Daniel Black <daniel@mariadb.org>
2026-04-02 09:28:48 +11:00
Marko Mäkelä
1a144f713a Merge 11.4 into 11.8 2026-04-01 15:03:59 +03:00
Vladislav Vaintroub
330f9b133f MDEV-28115 Hashicorp MTR tests aren't runnable on WIndows
- Fixed detection of "vault" utility
- Removed include/not_windows.inc from common include
- On Windows, skip 2 tests that rely on "grep"
- in mtr, set PATH to include mtr plugin directory (this is necessary
  to load vcpkg dependencies)
2026-03-25 19:36:23 +01:00