[CP] [CP] Add SRS_ID to columns table
This commit is contained in:
parent
afb6162c48
commit
294b33eb25
@ -887,7 +887,15 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString &database_name,
|
||||
cells[cell_idx].set_collation_type(ObCharset::get_default_collation(
|
||||
ObCharset::get_default_charset()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SRS_ID: {
|
||||
if (!column_schema->is_default_srid()) {
|
||||
cells[cell_idx].set_uint32(column_schema->get_srid());
|
||||
} else {
|
||||
cells[cell_idx].reset();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "invalid column id", K(ret), K(cell_idx),
|
||||
@ -1266,7 +1274,10 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const common::ObString &database_na
|
||||
}
|
||||
case GENERATION_EXPRESSION: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SRS_ID: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
SERVER_LOG(WARN, "invalid column id", K(ret), K(cell_idx),
|
||||
|
@ -38,7 +38,7 @@ namespace observer
|
||||
{
|
||||
class ObInfoSchemaColumnsTable : public common::ObVirtualTableScannerIterator
|
||||
{
|
||||
static const int32_t COLUMNS_COLUMN_COUNT = 21;
|
||||
static const int32_t COLUMNS_COLUMN_COUNT = 22;
|
||||
enum COLUMN_NAME {
|
||||
TABLE_SCHEMA = common::OB_APP_MIN_COLUMN_ID,
|
||||
TABLE_NAME,
|
||||
@ -60,7 +60,8 @@ class ObInfoSchemaColumnsTable : public common::ObVirtualTableScannerIterator
|
||||
EXTRA,
|
||||
PRIVILEGES,
|
||||
COLUMN_COMMENT,
|
||||
GENERATION_EXPRESSION
|
||||
GENERATION_EXPRESSION,
|
||||
SRS_ID
|
||||
};
|
||||
public:
|
||||
ObInfoSchemaColumnsTable();
|
||||
|
@ -9892,6 +9892,21 @@ int ObInnerTableSchema::all_virtual_information_columns_schema(ObTableSchema &ta
|
||||
generation_expression_default,
|
||||
generation_expression_default); //default_value
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ADD_COLUMN_SCHEMA("SRS_ID", //column_name
|
||||
++column_id, //column_id
|
||||
0, //rowkey_id
|
||||
0, //index_id
|
||||
0, //part_key_pos
|
||||
ObUInt32Type, //column_type
|
||||
CS_TYPE_INVALID, //column_collation_type
|
||||
sizeof(uint32_t), //column_length
|
||||
-1, //column_precision
|
||||
-1, //column_scale
|
||||
true, //is_nullable
|
||||
false); //is_autoincrement
|
||||
}
|
||||
table_schema.set_index_using_type(USING_HASH);
|
||||
table_schema.set_row_store_type(ENCODING_ROW_STORE);
|
||||
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
|
||||
|
@ -437,7 +437,8 @@ int ObInnerTableSchema::columns_schema(ObTableSchema &table_schema)
|
||||
EXTRA,
|
||||
PRIVILEGES,
|
||||
COLUMN_COMMENT,
|
||||
GENERATION_EXPRESSION
|
||||
GENERATION_EXPRESSION,
|
||||
SRS_ID
|
||||
FROM OCEANBASE.__ALL_VIRTUAL_INFORMATION_COLUMNS where 0 = sys_privilege_check('table_acc', effective_tenant_id(), table_schema, table_name))__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
|
@ -11270,7 +11270,8 @@ def_table_schema(
|
||||
('EXTRA', 'varchar:COLUMN_EXTRA_LENGTH', 'false', ''),
|
||||
('PRIVILEGES', 'varchar:MAX_COLUMN_PRIVILEGE_LENGTH', 'false', ''),
|
||||
('COLUMN_COMMENT', 'longtext', 'false', ''),
|
||||
('GENERATION_EXPRESSION', 'longtext', 'false', '')
|
||||
('GENERATION_EXPRESSION', 'longtext', 'false', ''),
|
||||
('SRS_ID', 'uint32', 'true')
|
||||
],
|
||||
)
|
||||
|
||||
@ -18468,7 +18469,8 @@ def_table_schema(
|
||||
EXTRA,
|
||||
PRIVILEGES,
|
||||
COLUMN_COMMENT,
|
||||
GENERATION_EXPRESSION
|
||||
GENERATION_EXPRESSION,
|
||||
SRS_ID
|
||||
FROM OCEANBASE.__ALL_VIRTUAL_INFORMATION_COLUMNS where 0 = sys_privilege_check('table_acc', effective_tenant_id(), table_schema, table_name)""",
|
||||
in_tenant_space = True,
|
||||
normal_columns = [ ],
|
||||
|
@ -26,6 +26,7 @@ desc information_schema.columns;
|
||||
| PRIVILEGES | varchar(200) | NO | | | |
|
||||
| COLUMN_COMMENT | longtext | NO | | | |
|
||||
| GENERATION_EXPRESSION | longtext | NO | | | |
|
||||
| SRS_ID | int(10) unsigned | YES | | NULL | |
|
||||
+--------------------------+---------------------+------+-----+---------+-------+
|
||||
desc information_schema.tables;
|
||||
+------------------------+---------------------+------+-----+---------+-------+
|
||||
|
@ -123,3 +123,13 @@ Outputs & filters:
|
||||
is_index_back=true, is_global_index=false,
|
||||
range_key([gis_point.x], [gis_point.y], [gis_point.__pk_increment]), range(MIN,MIN,MIN ; MAX,MAX,MAX)always true
|
||||
drop table if exists gis_point;
|
||||
drop table if exists t_test_srs_id_column;
|
||||
CREATE TABLE `t_test_srs_id_column` ( `id` INT PRIMARY KEY, `c1` POINT NOT NULL SRID 4326, `c2` GEOMETRY NOT NULL SRID 4326, `c3` POLYGON NOT NULL SRID 4326, `c4` GEOMETRY NOT NULL );
|
||||
SELECT `COLUMN_NAME`, `COLUMN_TYPE` /*!80003 ,`SRS_ID` */ FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` = 't_test_srs_id_column';
|
||||
COLUMN_NAME COLUMN_TYPE SRS_ID
|
||||
id int(11) NULL
|
||||
c1 point 4326
|
||||
c2 geometry 4326
|
||||
c3 polygon 4326
|
||||
c4 geometry NULL
|
||||
drop table t_test_srs_id_column;
|
||||
|
@ -111,3 +111,12 @@ call geom_insert(10000);
|
||||
explain select x,y,st_astext(poi) from gis_point order by x,y desc limit 1;
|
||||
|
||||
drop table if exists gis_point;
|
||||
|
||||
# test for SRS_ID column
|
||||
--disable_warnings
|
||||
drop table if exists t_test_srs_id_column;
|
||||
--enable_warnings
|
||||
CREATE TABLE `t_test_srs_id_column` ( `id` INT PRIMARY KEY, `c1` POINT NOT NULL SRID 4326, `c2` GEOMETRY NOT NULL SRID 4326, `c3` POLYGON NOT NULL SRID 4326, `c4` GEOMETRY NOT NULL );
|
||||
SELECT `COLUMN_NAME`, `COLUMN_TYPE` /*!80003 ,`SRS_ID` */ FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_NAME` = 't_test_srs_id_column';
|
||||
drop table t_test_srs_id_column;
|
||||
|
||||
|
@ -40,6 +40,7 @@ EXTRA varchar(4096) NO
|
||||
PRIVILEGES varchar(200) NO
|
||||
COLUMN_COMMENT longtext NO
|
||||
GENERATION_EXPRESSION longtext NO
|
||||
SRS_ID int(10) unsigned YES NULL
|
||||
desc global_status;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
@ -234,7 +235,8 @@ COLUMNS CREATE VIEW `COLUMNS` AS SELECT TABLE_CATALOG,
|
||||
EXTRA,
|
||||
PRIVILEGES,
|
||||
COLUMN_COMMENT,
|
||||
GENERATION_EXPRESSION
|
||||
GENERATION_EXPRESSION,
|
||||
SRS_ID
|
||||
FROM OCEANBASE.__ALL_VIRTUAL_INFORMATION_COLUMNS where 0 = sys_privilege_check('table_acc', effective_tenant_id(), table_schema, table_name) utf8mb4 utf8mb4_general_ci
|
||||
show create table global_status;
|
||||
Table Create Table
|
||||
|
@ -1433,6 +1433,7 @@ EXTRA varchar(4096) NO
|
||||
PRIVILEGES varchar(200) NO
|
||||
COLUMN_COMMENT longtext NO
|
||||
GENERATION_EXPRESSION longtext NO
|
||||
SRS_ID int(10) unsigned YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from information_schema.COLUMNS limit 1);
|
||||
cnt
|
||||
1
|
||||
|
@ -1434,6 +1434,7 @@ EXTRA varchar(4096) NO
|
||||
PRIVILEGES varchar(200) NO
|
||||
COLUMN_COMMENT longtext NO
|
||||
GENERATION_EXPRESSION longtext NO
|
||||
SRS_ID int(10) unsigned YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ count(*) as cnt from (select * from information_schema.COLUMNS limit 1);
|
||||
cnt
|
||||
1
|
||||
|
@ -1917,6 +1917,7 @@ EXTRA varchar(4096) NO
|
||||
PRIVILEGES varchar(200) NO
|
||||
COLUMN_COMMENT longtext NO
|
||||
GENERATION_EXPRESSION longtext NO
|
||||
SRS_ID int(10) unsigned YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__ALL_VIRTUAL_INFORMATION_COLUMNS;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
|
@ -4183,6 +4183,7 @@ EXTRA varchar(4096) NO
|
||||
PRIVILEGES varchar(200) NO
|
||||
COLUMN_COMMENT longtext NO
|
||||
GENERATION_EXPRESSION longtext NO
|
||||
SRS_ID int(10) unsigned YES NULL
|
||||
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__ALL_VIRTUAL_INFORMATION_COLUMNS;
|
||||
IF(count(*) >= 0, 1, 0)
|
||||
1
|
||||
|
Loading…
x
Reference in New Issue
Block a user