risingwave_frontend/catalog/system_catalog/information_schema/
columns.rsuse risingwave_common::types::Fields;
use risingwave_frontend_macro::system_catalog;
#[system_catalog(
view,
"information_schema.columns",
"SELECT CURRENT_DATABASE() AS table_catalog,
s.name AS table_schema,
r.name AS table_name,
c.name AS column_name,
NULL AS column_default,
NULL::integer AS character_maximum_length,
NULL::integer AS numeric_precision,
NULL::integer AS numeric_precision_radix,
NULL::integer AS numeric_scale,
NULL::integer AS datetime_precision,
c.position AS ordinal_position,
'YES' AS is_nullable,
CASE
WHEN c.data_type = 'varchar' THEN 'character varying'
ELSE c.data_type
END AS data_type,
CURRENT_DATABASE() AS udt_catalog,
'pg_catalog' AS udt_schema,
c.udt_type AS udt_name,
NULL AS character_set_catalog,
NULL AS character_set_schema,
NULL AS character_set_name,
NULL AS collation_catalog,
NULL AS collation_schema,
NULL AS collation_name,
NULL AS domain_catalog,
NULL AS domain_schema,
NULL AS domain_name,
NULL AS scope_catalog,
NULL AS scope_schema,
NULL AS scope_name,
'NO' AS is_identity,
NULL AS identity_generation,
NULL AS identity_start,
NULL AS identity_increment,
NULL AS identity_maximum,
NULL AS identity_minimum,
NULL AS identity_cycle,
CASE
WHEN c.is_generated THEN 'ALWAYS'
ELSE 'NEVER'
END AS is_generated,
c.generation_expression,
NULL AS interval_type
FROM rw_catalog.rw_columns c
LEFT JOIN rw_catalog.rw_relations r ON c.relation_id = r.id
JOIN rw_catalog.rw_schemas s ON s.id = r.schema_id
WHERE c.is_hidden = false"
)]
#[derive(Fields)]
struct Column {
table_catalog: String,
table_schema: String,
table_name: String,
column_name: String,
column_default: String,
character_maximum_length: i32,
numeric_precision: i32,
numeric_precision_radix: i32,
numeric_scale: i32,
datetime_precision: i32,
ordinal_position: i32,
is_nullable: String,
data_type: String,
udt_catalog: String,
udt_schema: String,
udt_name: String,
character_set_catalog: String,
character_set_schema: String,
character_set_name: String,
collation_catalog: String,
collation_schema: String,
collation_name: String,
domain_catalog: String,
domain_schema: String,
domain_name: String,
scope_catalog: String,
scope_schema: String,
scope_name: String,
is_identity: String,
identity_generation: String,
identity_start: String,
identity_increment: String,
identity_maximum: String,
identity_minimum: String,
identity_cycle: String,
is_generated: String,
generation_expression: String,
interval_type: String,
}