You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-5005 Add charset number to system catalog - Part 2.
1. Extend the calpontsys.syscolumn system catalog table with a new column, 'charsetnum'. 'charsetnum' field is set to the 'number' member of the 'charset_info_st' struct defined in the server in m_ctype.h. For CHAR/VARCHAR/TEXT column types, 'charset_info_st' is initialized to the charset/collation of the column, which is set at the column-level or at the table-level in the DDL. For BLOB/VARBINARY binary column types, 'charset_info_st' is initialized to my_charset_bin (charsetnum=63). For all other column types, charsetnum is set to 0. 2. Add support for the newly added 'charsetnum' column in the automatic system catalog upgrade logic in dbbuilder. For existing table definitions, charsetnum for the column is defaulted to 0. 3. Add MTR test case that creates a few table definitions with a range of charset/collation combinations and queries the calpontsys.syscolumn system catalog table with the charsetnum field for the columns in the table DDLs.
This commit is contained in:
@ -56,7 +56,7 @@ int ddllex(YYSTYPE* ddllval, void* yyscanner);
|
||||
void ddlerror(struct pass_to_bison* x, char const *s);
|
||||
char* copy_string(const char *str);
|
||||
|
||||
void fix_column_length(SchemaObject* elem, const CHARSET_INFO* def_cs)
|
||||
void fix_column_length_and_charset(SchemaObject* elem, const CHARSET_INFO* def_cs)
|
||||
{
|
||||
auto* column = dynamic_cast<ColumnDef*>(elem);
|
||||
|
||||
@ -338,7 +338,7 @@ create_table_statement:
|
||||
{
|
||||
for (auto* elem : *$6)
|
||||
{
|
||||
fix_column_length(elem, x->default_table_charset);
|
||||
fix_column_length_and_charset(elem, x->default_table_charset);
|
||||
}
|
||||
$$ = new CreateTableStatement(new TableDef($4, $6, $8));
|
||||
}
|
||||
@ -702,17 +702,17 @@ ata_add_column:
|
||||
/* See the documentation for SchemaObject for an explanation of why we are using
|
||||
* dynamic_cast here.
|
||||
*/
|
||||
ADD column_def { fix_column_length($2, x->default_table_charset); $$ = new AtaAddColumn(dynamic_cast<ColumnDef*>($2));}
|
||||
| ADD COLUMN column_def { fix_column_length($3, x->default_table_charset); $$ = new AtaAddColumn(dynamic_cast<ColumnDef*>($3));}
|
||||
ADD column_def { fix_column_length_and_charset($2, x->default_table_charset); $$ = new AtaAddColumn(dynamic_cast<ColumnDef*>($2));}
|
||||
| ADD COLUMN column_def { fix_column_length_and_charset($3, x->default_table_charset); $$ = new AtaAddColumn(dynamic_cast<ColumnDef*>($3));}
|
||||
| ADD '(' table_element_list ')' {
|
||||
for (auto* elem : *$3) {
|
||||
fix_column_length(elem, x->default_table_charset);
|
||||
fix_column_length_and_charset(elem, x->default_table_charset);
|
||||
}
|
||||
$$ = new AtaAddColumns($3);
|
||||
}
|
||||
| ADD COLUMN '(' table_element_list ')' {
|
||||
for (auto* elem : *$4) {
|
||||
fix_column_length(elem, x->default_table_charset);
|
||||
fix_column_length_and_charset(elem, x->default_table_charset);
|
||||
}
|
||||
$$ = new AtaAddColumns($4);
|
||||
}
|
||||
|
Reference in New Issue
Block a user