Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add pg_rewrite and pg_depend tables #2612

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading