pub struct PostgresIntrospector { /* private fields */ }Expand description
PostgreSQL introspector for fact table metadata.
Implementations§
Source§impl PostgresIntrospector
impl PostgresIntrospector
Sourcepub async fn get_index_definitions(
&self,
relation: &str,
) -> Result<Vec<IndexInfo>>
pub async fn get_index_definitions( &self, relation: &str, ) -> Result<Vec<IndexInfo>>
Every index on relation, keys in declared order (#1307).
Keys come from pg_get_indexdef(indexrelid, n, true) rather than from
pg_attribute, because an expression key has no attnum: the JSONB
identity a page is tie-broken on (data->>'id') is indexed as an
expression, and reading indkey alone would report that index as having
fewer keys than it has.
Returns an empty vector for a view — a view carries no indexes, so a
caller holding a sql_source must resolve it with
resolve_base_relations first.
§Errors
Returns FraiseQLError::Database if the catalog query fails.
Sourcepub async fn resolve_base_relations(&self, view: &str) -> Result<Vec<String>>
pub async fn resolve_base_relations(&self, view: &str) -> Result<Vec<String>>
The tables and materialized views a view reads from (#1307).
A query binds to v_invoice, and v_invoice has no indexes — the indexes
that decide whether a page needs a sort live on tb_invoice. Resolved
through pg_rewrite/pg_depend rather than by assuming a v_/tb_
naming convention, which is a project convention and not a guarantee about
any particular database.
Returns every base relation the view depends on. More than one means the view is a join, and a caller cannot attribute an ordering to a single table without reading the view body.
§Errors
Returns FraiseQLError::Database if the catalog query fails.
Trait Implementations§
Source§impl DatabaseIntrospector for PostgresIntrospector
impl DatabaseIntrospector for PostgresIntrospector
Source§async fn list_fact_tables(&self) -> Result<Vec<String>>
async fn list_fact_tables(&self) -> Result<Vec<String>>
Source§async fn get_columns(
&self,
table_name: &str,
) -> Result<Vec<(String, String, bool)>>
async fn get_columns( &self, table_name: &str, ) -> Result<Vec<(String, String, bool)>>
Source§async fn get_indexed_columns(&self, table_name: &str) -> Result<Vec<String>>
async fn get_indexed_columns(&self, table_name: &str) -> Result<Vec<String>>
Source§fn database_type(&self) -> DatabaseType
fn database_type(&self) -> DatabaseType
Source§async fn list_relations(&self) -> Result<Vec<RelationInfo>>
async fn list_relations(&self) -> Result<Vec<RelationInfo>>
Source§async fn get_sample_jsonb(
&self,
table_name: &str,
column_name: &str,
) -> Result<Option<Value>>
async fn get_sample_jsonb( &self, table_name: &str, column_name: &str, ) -> Result<Option<Value>>
Source§async fn get_sample_json_rows(
&self,
table_name: &str,
column_name: &str,
limit: usize,
) -> Result<Vec<Value>>
async fn get_sample_json_rows( &self, table_name: &str, column_name: &str, limit: usize, ) -> Result<Vec<Value>>
Source§async fn function_exists(
&self,
schema: Option<&str>,
name: &str,
) -> Result<Option<bool>>
async fn function_exists( &self, schema: Option<&str>, name: &str, ) -> Result<Option<bool>>
name exists — in schema
when given, else resolved against the connection search_path. Read moreSource§async fn qualified_relation_exists(
&self,
schema: &str,
name: &str,
) -> Result<Option<bool>>
async fn qualified_relation_exists( &self, schema: &str, name: &str, ) -> Result<Option<bool>>
sql_source (quote_postgres_identifier + to_regclass), so a mixed-case
relation in an off-search_path schema is not falsely reported missing. Read more