Skip to content

Commit

Permalink
fix: remove matviewgraph column from pg_matviews (#16246)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuyufjh authored Apr 11, 2024
1 parent fac2119 commit 1cc84f7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
12 changes: 6 additions & 6 deletions e2e_test/ddl/show.slt
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ describe pg_matviews;
schemaname character varying false NULL
matviewname character varying false NULL
matviewowner integer false NULL
tablespace character varying false NULL
hasindexes boolean false NULL
ispopulated boolean false NULL
definition character varying false NULL
matviewid integer false NULL
matviewtimezone character varying false NULL
matviewgraph character varying false NULL
table description pg_matviews NULL NULL

query TTTT
Expand All @@ -211,7 +211,7 @@ show columns from pg_catalog.pg_matviews;
schemaname character varying false NULL
matviewname character varying false NULL
matviewowner integer false NULL
tablespace character varying false NULL
hasindexes boolean false NULL
ispopulated boolean false NULL
definition character varying false NULL
matviewid integer false NULL
matviewtimezone character varying false NULL
matviewgraph character varying false NULL
30 changes: 13 additions & 17 deletions src/frontend/src/catalog/system_catalog/pg_catalog/pg_matviews.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,24 @@ use risingwave_frontend_macro::system_catalog;
#[system_catalog(
view,
"pg_catalog.pg_matviews",
"SELECT schemaname,
i.relationname AS matviewname,
i.relationowner AS matviewowner,
definition,
i.relationid AS matviewid,
i.relationtimezone AS matviewtimezone,
i.fragments AS matviewgraph
FROM rw_catalog.rw_relation_info i
WHERE i.relationtype = 'MATERIALIZED VIEW'"
"SELECT
s.name as schemaname,
mv.name as matviewname,
mv.owner as matviewowner,
NULL AS tablespace,
false AS hasindexes,
true AS ispopulated,
mv.definition as definition
FROM rw_materialized_views mv
JOIN rw_schemas s ON mv.schema_id = s.id"
)]
#[derive(Fields)]
struct PgMatview {
schemaname: String,
matviewname: String,
matviewowner: i32,
tablespace: Option<String>,
hasindexes: bool,
ispopulated: bool,
definition: String,
// Below are some columns that PostgreSQL doesn't have.
// TODO: these field is only exist in RW and used by cloud side, need to remove it and let
// cloud switch to use `rw_catalog.rw_relation_info`.
matviewid: i32,
// The timezone used to interpret ambiguous dates/timestamps as tstz
matviewtimezone: String,
// materialized view graph is json encoded fragment infos.
matviewgraph: String,
}

0 comments on commit 1cc84f7

Please sign in to comment.