Skip to content

Commit

Permalink
add pg_rewrite and pg_depend
Browse files Browse the repository at this point in the history
  • Loading branch information
talagluck committed Feb 8, 2024
1 parent 3ec75e6 commit 62fc3b0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
31 changes: 31 additions & 0 deletions crates/sqlbuiltins/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,35 @@ pub static PG_MATVIEWS: Lazy<BuiltinView> = Lazy::new(|| BuiltinView {
",
});

pub static PG_REWRITE: Lazy<BuiltinView> = Lazy::new(|| BuiltinView {
schema: POSTGRES_SCHEMA,
name: "pg_rewrite",
sql: "
SELECT 0 as oid,
'' as rulename,
0 as ev_class,
1 as ev_type,
'D' as ev_enabled,
false as is_instead,
null as ev_qual,
null as ev_action
",
});

pub static PG_DEPEND: Lazy<BuiltinView> = Lazy::new(|| BuiltinView {
schema: POSTGRES_SCHEMA,
name: "pg_depend",
sql: "
SELECT 0 as classid,
0 as objid,
0 as objsubid,
0 as refclassid,
0 as refobjid,
0 as refobjdubid,
'a' as deptype,
",
});

impl BuiltinView {
pub fn builtins() -> Vec<&'static BuiltinView> {
vec![
Expand All @@ -721,6 +750,8 @@ impl BuiltinView {
&PG_VIEWS,
&PG_TYPE,
&PG_MATVIEWS,
&PG_REWRITE,
&PG_DEPEND
]
}
}
Expand Down
6 changes: 6 additions & 0 deletions testdata/sqllogictests/pg_catalog.slt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ LIMIT 1000;
statement ok
select * from pg_matviews;

statement ok
select * from pg_rewrite;

statement ok
select * from pg_depend;

# https://github.com/GlareDB/glaredb/issues/2475
statement ok
WITH table_privileges AS (
Expand Down

0 comments on commit 62fc3b0

Please sign in to comment.