Skip to content

Commit f99e0eb

Browse files
authored
feat: add pg_catalog and its tables (#86)
* feat: add pg_class and pg_type table * feat: add pg_am and pg_namespace table * feat: add pg_database * chore: update toolchain * chore: bypass warning
1 parent 67edfed commit f99e0eb

File tree

4 files changed

+615
-9
lines changed

4 files changed

+615
-9
lines changed

datafusion-postgres-cli/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use datafusion::execution::options::{
66
ArrowReadOptions, AvroReadOptions, CsvReadOptions, NdJsonReadOptions, ParquetReadOptions,
77
};
88
use datafusion::prelude::{SessionConfig, SessionContext};
9+
use datafusion_postgres::pg_catalog::PgCatalogSchemaProvider;
910
use datafusion_postgres::{serve, ServerOptions}; // Assuming the crate name is `datafusion_postgres`
1011
use structopt::StructOpt;
1112

@@ -169,6 +170,13 @@ async fn setup_session_context(
169170
println!("Loaded {} as table {}", table_path, table_name);
170171
}
171172

173+
// Register pg_catalog
174+
let pg_catalog = PgCatalogSchemaProvider::new(session_context.state().catalog_list().clone());
175+
session_context
176+
.catalog("datafusion")
177+
.unwrap()
178+
.register_schema("pg_catalog", Arc::new(pg_catalog))?;
179+
172180
Ok(())
173181
}
174182

datafusion-postgres/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
mod datatypes;
22
mod encoder;
33
mod handlers;
4+
pub mod pg_catalog;
45

56
use std::sync::Arc;
67

0 commit comments

Comments
 (0)