risingwave_frontend/catalog/system_catalog/information_schema/
columns.rs1use risingwave_common::types::Fields;
16use risingwave_frontend_macro::system_catalog;
17
18#[system_catalog(
25 view,
26 "information_schema.columns",
27 "SELECT CURRENT_DATABASE() AS table_catalog,
28 s.name AS table_schema,
29 r.name AS table_name,
30 c.name AS column_name,
31 NULL AS column_default,
32 NULL::integer AS character_maximum_length,
33 NULL::integer AS numeric_precision,
34 NULL::integer AS numeric_precision_radix,
35 NULL::integer AS numeric_scale,
36 NULL::integer AS datetime_precision,
37 c.position AS ordinal_position,
38 CASE
39 WHEN c.is_nullable THEN 'YES'
40 ELSE 'NO'
41 END AS is_nullable,
42 CASE
43 WHEN c.data_type = 'varchar' THEN 'character varying'
44 ELSE c.data_type
45 END AS data_type,
46 CURRENT_DATABASE() AS udt_catalog,
47 'pg_catalog' AS udt_schema,
48 c.udt_type AS udt_name,
49 NULL AS character_set_catalog,
50 NULL AS character_set_schema,
51 NULL AS character_set_name,
52 NULL AS collation_catalog,
53 NULL AS collation_schema,
54 NULL AS collation_name,
55 NULL AS domain_catalog,
56 NULL AS domain_schema,
57 NULL AS domain_name,
58 NULL AS scope_catalog,
59 NULL AS scope_schema,
60 NULL AS scope_name,
61 'NO' AS is_identity,
62 NULL AS identity_generation,
63 NULL AS identity_start,
64 NULL AS identity_increment,
65 NULL AS identity_maximum,
66 NULL AS identity_minimum,
67 NULL AS identity_cycle,
68 CASE
69 WHEN c.is_generated THEN 'ALWAYS'
70 ELSE 'NEVER'
71 END AS is_generated,
72 c.generation_expression,
73 NULL AS interval_type
74 FROM rw_catalog.rw_columns c
75 LEFT JOIN rw_catalog.rw_relations r ON c.relation_id = r.id
76 JOIN rw_catalog.rw_schemas s ON s.id = r.schema_id
77 WHERE c.is_hidden = false"
78)]
79#[derive(Fields)]
80struct Column {
81 table_catalog: String,
82 table_schema: String,
83 table_name: String,
84 column_name: String,
85 column_default: String,
86 character_maximum_length: i32,
87 numeric_precision: i32,
88 numeric_precision_radix: i32,
89 numeric_scale: i32,
90 datetime_precision: i32,
91 ordinal_position: i32,
92 is_nullable: String,
93 data_type: String,
94 udt_catalog: String,
95 udt_schema: String,
96 udt_name: String,
97 character_set_catalog: String,
98 character_set_schema: String,
99 character_set_name: String,
100 collation_catalog: String,
101 collation_schema: String,
102 collation_name: String,
103 domain_catalog: String,
104 domain_schema: String,
105 domain_name: String,
106 scope_catalog: String,
107 scope_schema: String,
108 scope_name: String,
109 is_identity: String,
110 identity_generation: String,
111 identity_start: String,
112 identity_increment: String,
113 identity_maximum: String,
114 identity_minimum: String,
115 identity_cycle: String,
116 is_generated: String,
117 generation_expression: String,
118 interval_type: String,
119}