Files
greptimedb/tests/cases/standalone/common/system/information_schema.sql
dennis zhuang 65d47bab56 feat: adds information_schema cluster_info table (#3832)
* feat: adds server running mode to KvBackendCatalogManager

* feat: adds MetaClient to KvBackendCatalogManager

* feat: impl information_schema.cluster_info table

* fix: forgot files

* test: update information_schema result

* feat: adds start_time and uptime to cluster_info

* chore: tweak cargo and comment

* feat: rename greptime_region_peers to region_peers

* fix: cluster_info result

* chore: simplify sqlness commands

* chore: set peer_id to -1 for frontends

* fix: move cluster_info to greptime catalog

* chore: use official proto

* feat: adds active_time

* chore: apply suggestion

Co-authored-by: Jeremyhi <jiachun_feng@proton.me>

* chore: STANDALONE for runtime_metrics

---------

Co-authored-by: Jeremyhi <jiachun_feng@proton.me>
Co-authored-by: tison <wander4096@gmail.com>
2024-05-02 02:49:46 +00:00

129 lines
2.9 KiB
SQL

-- should not able to create information_schema
create database information_schema;
-- scripts table has different table ids in different modes
select *
from information_schema.tables
where table_name != 'scripts'
order by table_schema, table_name;
select * from information_schema.columns order by table_schema, table_name, column_name;
create
database my_db;
use my_db;
create table foo
(
ts TIMESTAMP TIME INDEX
);
select table_name
from information_schema.tables
where table_schema = 'my_db'
order by table_name;
select table_name
from information_schema.tables
where table_schema in ('my_db', 'public')
order by table_name;
select table_name
from information_schema.tables
where table_schema like 'my%'
order by table_name;
select table_name
from information_schema.tables
where table_schema not in ('my_db', 'information_schema')
order by table_name;
select table_catalog, table_schema, table_name, table_type, engine
from information_schema.tables
where table_catalog = 'greptime'
and table_schema != 'public'
and table_schema != 'information_schema'
order by table_schema, table_name;
select table_catalog, table_schema, table_name, column_name, data_type, semantic_type
from information_schema.columns
where table_catalog = 'greptime'
and table_schema != 'public'
and table_schema != 'information_schema'
order by table_schema, table_name, column_name;
-- test query filter for columns --
select table_catalog, table_schema, table_name, column_name, data_type, semantic_type
from information_schema.columns
where table_catalog = 'greptime'
and (table_schema in ('public')
or
table_schema == 'my_db')
order by table_schema, table_name, column_name;
use public;
drop schema my_db;
use information_schema;
-- test query filter for key_column_usage --
select * from KEY_COLUMN_USAGE where CONSTRAINT_NAME = 'TIME INDEX';
select * from KEY_COLUMN_USAGE where CONSTRAINT_NAME != 'TIME INDEX';
select * from KEY_COLUMN_USAGE where CONSTRAINT_NAME LIKE '%INDEX';
select * from KEY_COLUMN_USAGE where CONSTRAINT_NAME NOT LIKE '%INDEX';
select * from KEY_COLUMN_USAGE where CONSTRAINT_NAME == 'TIME INDEX' AND CONSTRAINT_SCHEMA != 'my_db';
-- schemata --
desc table schemata;
select * from schemata where catalog_name = 'greptime' and schema_name != 'public' order by catalog_name, schema_name;
-- test engines
select * from engines;
desc table build_info;
select count(*) from build_info;
desc table key_column_usage;
select * from key_column_usage;
-- tables not implemented
DESC TABLE COLUMN_PRIVILEGES;
SELECT * FROM COLUMN_PRIVILEGES;
DESC TABLE COLUMN_STATISTICS;
SELECT * FROM COLUMN_STATISTICS;
SELECT * FROM CHARACTER_SETS;
SELECT * FROM COLLATIONS;
SELECT * FROM COLLATION_CHARACTER_SET_APPLICABILITY;
DESC TABLE CHECK_CONSTRAINTS;
SELECT * FROM CHECK_CONSTRAINTS;
DESC TABLE RUNTIME_METRICS;
DESC TABLE REGION_PEERS;
USE INFORMATION_SCHEMA;
DESC COLUMNS;
drop table my_db.foo;
use public;