1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Cleanup: fake_select_lex->select_number=FAKE_SELECT_LEX_ID, not [U]INT_MAX

SELECT_LEX objects that are "fake_select_lex" (i.e read UNION output)
used both INT_MAX and UINT_MAX as select_number.
- mysql_explain_union() assigned UINT_MAX
- st_select_lex_unit::add_fake_select_lex assigned INT_MAX

This didn't matter initially (before EXPLAIN FORMAT=JSON), because the
code  had no checks for this value.

EXPLAIN FORMAT=JSON and later other features did introduce checks for
select_number values. The check had to check for two constants and
looked really confusing.

This patch joins the two constants into one - FAKE_SELECT_LEX_ID.
This commit is contained in:
Sergei Petrunia
2021-04-15 00:19:13 +03:00
parent 3f138fa3a5
commit 2656e87682
5 changed files with 15 additions and 19 deletions

View File

@ -74,7 +74,7 @@ class Json_writer;
*************************************************************************************/
const int FAKE_SELECT_LEX_ID= (int)UINT_MAX;
const uint FAKE_SELECT_LEX_ID= UINT_MAX;
class Explain_query;
@ -108,7 +108,7 @@ public:
};
virtual enum explain_node_type get_type()= 0;
virtual int get_select_id()= 0;
virtual uint get_select_id()= 0;
/**
expression cache statistics
@ -166,9 +166,9 @@ public:
bool add_table(Explain_table_access *tab, Explain_query *query);
int get_select_id() { return select_id; }
uint get_select_id() { return select_id; }
int select_id;
uint select_id;
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
@ -352,7 +352,7 @@ public:
enum explain_node_type get_type() { return EXPLAIN_UNION; }
unit_common_op operation;
int get_select_id()
uint get_select_id()
{
DBUG_ASSERT(union_members.elements() > 0);
return union_members.at(0);
@ -879,7 +879,7 @@ public:
{}
virtual enum explain_node_type get_type() { return EXPLAIN_UPDATE; }
virtual int get_select_id() { return 1; /* always root */ }
virtual uint get_select_id() { return 1; /* always root */ }
const char *select_type;
@ -959,7 +959,7 @@ public:
StringBuffer<64> table_name;
enum explain_node_type get_type() { return EXPLAIN_INSERT; }
int get_select_id() { return 1; /* always root */ }
uint get_select_id() { return 1; /* always root */ }
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
@ -986,7 +986,7 @@ public:
bool deleting_all_rows;
virtual enum explain_node_type get_type() { return EXPLAIN_DELETE; }
virtual int get_select_id() { return 1; /* always root */ }
virtual uint get_select_id() { return 1; /* always root */ }
virtual int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);