Details
-
Task
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
Q1/2026 Server Development
Description
Type_handler::Column_definition_fix_attributes() is an addition for Type_handler::Column_definition_set_attributes(). Let's move all the code from virtual implementations of Column_definition_fix_attributes() to the corresponding virtual implementations of Column_definition_set_attributes().
This change is needed to simplify handling of TYPE directives.
In the upcoming task MDEV-10152 Add support for TYPE .. IS REF CURSOR there is a difference in the following two scenarios:
TYPE rec0_t IS RECORD (a INT, b TIME); |
TYPE cur0_t IS REF CURSOR RETURN rec0_t; |
and
TYPE rec0_t IS RECORD (a INT, b TIME); |
c0 rec0_t;
|
TYPE cur0_t IS REF CURSOR RETURN c0%TYPE; |
- In the first scenario, the cursor's RETURN type is rec0_t, which is stored in sp_type_def_list as an sp_type_def_record instance whose Row_definition_list is populated with Spvar_definition element which have undergone through Column_definition_set_attributes() but have not ungergone through Column_definition_fix_attributes()
- In the second scenario, the cursor's RETURN type is c0%TYPE - it's derived from a variable which have already ungergone both Column_definition_set_attributes() and Column_definition_fix_attributes().
This difference is hard to handle.
Unifying the two methods in a single method will make the code easier to understand and easier to maintain, e.g. for the purposes like the described above, as well as generally.
For example, the current code is rather confusing:
(1) After Column_definition_set_attributes():
- Column_definition::length means the fractional precision
- Column_definition::decimals is set to 0
(2) After Column_definition_fix_attributes(): - Column_definition::length means the full character length
- Column_definition::decimals means the fractional precision
We don't need the state #1. After the proposed change everything will be set to the state #2 right after the parser.
Attachments
Issue Links
- blocks
-
MDEV-10152 Add support for TYPE .. IS REF CURSOR
-
- In Review
-