- Defining MariaDB_FUNCTION_PLUGIN
- Changing the code in /plugins/type_inet/ and /plugins/type_test/
to use MariaDB_FUNCTION_PLUGIN instead of MariaDB_FUNCTION_COLLECTION_PLUGIN.
- Changing maturity for the INET6 data type plugin from experimental to alpha.
This clause in CREATE TABLE:
PARTITION BY LIST COLUMNS (inet6column)
(PARTITION p1 VALUES IN ('::'))
was erroneously written to frm file as:
PARTITION BY LIST COLUMNS(inet6column)
(PARTITION p1 VALUES IN (_binary 0x3A3A))
I.e. the text value '::' was converted to HEX representation
and prefixed with _binary.
A simple fix could write `_latin1 0x3A3A` instead of `_binary 0x3A3A`,
but in case of INET6 we don't need neither character set introducers,
nor HEX encoding, because text representation of INET6 values consist
of pure ASCII characters.
So this patch changes the above clause to be printed as:
PARTITION BY LIST COLUMNS(inet6column)
(PARTITION p1 VALUES IN ('::'))
Details:
The old code in check_part_field() was not friendly to pluggable data types.
Replacing this function to two new virtual methods in Type_handler:
virtual bool partition_field_check(const LEX_CSTRING &field_name,
Item *item_expr) const;
virtual bool partition_field_append_value(String *str,
Item *item_expr,
CHARSET_INFO *field_cs,
partition_value_print_mode_t mode)
const;
so data type plugins can decide whether they need to use character set
introducer and/or hex encoding when printing partition values.
The code erroneously assumed that only Field_str descendants can
store character set information. After adding Field_inet6, it's
not true anymore.
Also, after adding Field_inet6, storing field->charset() become not correct either:
- Field_inet6::charset() return &my_charset_latin1,
because clients see INET6 as VARCHAR(39).
- Field_inet6::binlog_type_info().m_cs returns &my_charset_bin
because storage engines see INET6 as BINARY(16).
We need to store &my_charset_bin to the binlog metadata,
so the slave sees INET6 as BINARY(16), like storage engines do,
to make the slave treat the replicated data as binary IPv6 address
representation (rather than text representation).
The correct character set that needs to be stored to the metadata
is already populated to binlog_type_info_array[i].m_cs. So the
fixed code version uses this value rather than field->charset().
post-review fixes:
* test for dependent subqueries
* test for triggers and routines
* disallow INSERT...RETURNING in triggers and stored functions
* don't return anything if INSERT IGNORE ignored an error
when there are nested subqueries, and a field in a subquery is
resolved as an outer reference to a table few levels up, all subqueries
the subquery with a reference and all subqueries up to subquery with
the table must be marked as dependent.
in the text protocol and PS-prepare step it happens in
Item_field::fix_outer_field in a loop that walks contexts
using context->outer_context.
in PS-execute step Item_field->cached_table is set and subqueries
are walked in a PS-only mark_select_range_as_dependent(),
which inconsistently walks SELECT_LEX'es using select_lex->outer_select().
Fix mark_select_range_as_dependent() to walk contexts, not SELECT_LEX'es,
to have the same logic both in prepare and execute steps.
This fixes a crash in main.insert_returning in --ps-protocol
because internally setup_wild() adjusts select_lex->with_wild directly
anyway, so there is no reason to pretend that the number of '*' may be
anything else but select_lex->with_wild
And don't update select_lex->item_list, because fields can come
from anywhere and don't necessarily have to be copied into select_lex.
make load_defaults() store the file name in the generated option list
using a special marker ---file-marker--- option.
Pick up this filename in handle_options().
Remove ---args-separator---, use ---file-marker--- with an empty file
name instead - this simplifies checks on the caller, only one special
option to recognize.
only my_getopt should use it, because it changes my_getopt's behavior.
If one simply wants to skip the separator - don't ask it to be added
in the first place
almost all my_getopt settings and callbacks are global variables,
directly assignable to configure my_getopt. Only getopt_get_addr
was using a setter function. Get rid of it, make it a global
directly assignable variable like all other settings.
Also make getopt_compare_strings() static.
The patch for `MDEV-20795 CAST(inet6 AS BINARY) returns wrong result`
unintentionally changed what Item_char_typecast::type_handler()
returns. This broke UNIONs with the BINARY() function, as the Aria
engine started to get columns of unexpected data types.
Restoring previous behaviour, to return
Type_handler::string_type_handler(max_length).
The prototype for Item_handed_func::return_type_handler() has changed
from:
const Type_handler *return_type_handler() const
to:
const Type_handler *return_type_handler(const Item_handled_func *) const
Now both offset and limit are stored and do not chenged during execution
(offset is decreased during processing in versions before 10.5).
(Big part of this changes made by Monty)
These two methods:
- Item_result_field::create_tmp_field_ex()
- Item_func_user_var::create_tmp_field_ex()
had duplicate code, except that they used a different type handler.
Adding a protected method Item_result_field::create_tmp_field_ex_from_handler()
with a "const Type_handler*" parameter, and reusing it from the
two mentioned methods.
Field::marked_for_read() and Field::marked_for_write_or_computed()
are being called from plugin/type_inet/sql_type_inet.cc ever since
commit 6ea5c2b5b6
and thus they cannot be declared inline any more.
TABLE::mark_columns_needed_for_update(): use_all_columns() assigns
pointer of all_set into read_set and write_set, but this is not good
since all_set is changed later by
TABLE::mark_columns_used_by_index_no_reset().
Do column_bitmaps_signal() whenever we change read_set/write_set.