Skip to content

Commit

Permalink
chore: populate pg_attribute.attgenerated and pg_type.typdelim (#16436)
Browse files Browse the repository at this point in the history
  • Loading branch information
yezizp2012 authored Apr 22, 2024
1 parent 2a11205 commit ea45c35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
- sql: |
select * from pg_catalog.pg_type
logical_plan: |-
LogicalProject { exprs: [pg_type.oid, pg_type.typname, pg_type.typelem, pg_type.typarray, pg_type.typinput, pg_type.typnotnull, pg_type.typbasetype, pg_type.typtypmod, pg_type.typcollation, pg_type.typlen, pg_type.typnamespace, pg_type.typtype, pg_type.typrelid, pg_type.typdefault, pg_type.typcategory, pg_type.typreceive] }
└─LogicalSysScan { table: pg_type, columns: [pg_type.oid, pg_type.typname, pg_type.typelem, pg_type.typarray, pg_type.typinput, pg_type.typnotnull, pg_type.typbasetype, pg_type.typtypmod, pg_type.typcollation, pg_type.typlen, pg_type.typnamespace, pg_type.typtype, pg_type.typrelid, pg_type.typdefault, pg_type.typcategory, pg_type.typreceive] }
batch_plan: 'BatchScan { table: pg_type, columns: [pg_type.oid, pg_type.typname, pg_type.typelem, pg_type.typarray, pg_type.typinput, pg_type.typnotnull, pg_type.typbasetype, pg_type.typtypmod, pg_type.typcollation, pg_type.typlen, pg_type.typnamespace, pg_type.typtype, pg_type.typrelid, pg_type.typdefault, pg_type.typcategory, pg_type.typreceive], distribution: Single }'
LogicalProject { exprs: [pg_type.oid, pg_type.typname, pg_type.typelem, pg_type.typarray, pg_type.typinput, pg_type.typnotnull, pg_type.typbasetype, pg_type.typtypmod, pg_type.typcollation, pg_type.typlen, pg_type.typnamespace, pg_type.typtype, pg_type.typdelim, pg_type.typrelid, pg_type.typdefault, pg_type.typcategory, pg_type.typreceive] }
└─LogicalSysScan { table: pg_type, columns: [pg_type.oid, pg_type.typname, pg_type.typelem, pg_type.typarray, pg_type.typinput, pg_type.typnotnull, pg_type.typbasetype, pg_type.typtypmod, pg_type.typcollation, pg_type.typlen, pg_type.typnamespace, pg_type.typtype, pg_type.typdelim, pg_type.typrelid, pg_type.typdefault, pg_type.typcategory, pg_type.typreceive] }
batch_plan: 'BatchScan { table: pg_type, columns: [pg_type.oid, pg_type.typname, pg_type.typelem, pg_type.typarray, pg_type.typinput, pg_type.typnotnull, pg_type.typbasetype, pg_type.typtypmod, pg_type.typcollation, pg_type.typlen, pg_type.typnamespace, pg_type.typtype, pg_type.typdelim, pg_type.typrelid, pg_type.typdefault, pg_type.typcategory, pg_type.typreceive], distribution: Single }'
- sql: |
select * from pg_catalog.pg_namespace
logical_plan: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ use risingwave_frontend_macro::system_catalog;
false AS atthasdef,
false AS attisdropped,
''::varchar AS attidentity,
''::varchar AS attgenerated,
CASE
WHEN c.is_generated THEN 's'::varchar
ELSE ''::varchar
END AS attgenerated,
-1 AS atttypmod,
0 AS attcollation
FROM rw_catalog.rw_columns c
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/src/catalog/system_catalog/pg_catalog/pg_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use crate::error::Result;
// 0 AS typlen,
// s.id AS typnamespace,
// 'b' AS typtype,
// ',' AS typdelim,
// 0 AS typrelid,
// NULL AS typdefault,
// NULL AS typcategory,
Expand All @@ -64,6 +65,7 @@ struct PgType {
typlen: i32,
typnamespace: i32,
typtype: char,
typdelim: char,
typrelid: i32,
typdefault: Option<String>,
typcategory: Option<String>,
Expand Down Expand Up @@ -94,6 +96,7 @@ fn read_pg_type(reader: &SysCatalogReaderImpl) -> Result<Vec<PgType>> {
typlen: 0,
typnamespace: pg_catalog_id,
typtype: 'b',
typdelim: ',',
typrelid: 0,
typdefault: None,
typcategory: None,
Expand Down

0 comments on commit ea45c35

Please sign in to comment.