Skip to main content

no_mistakes_postgres_sql/
lib.rs

1//! PostgreSQL SQL parsing, statement facts, and identifier extraction.
2
3#[doc(hidden)]
4pub mod erased_visit;
5#[doc(hidden)]
6pub mod erased_visit_capture;
7#[doc(hidden)]
8pub mod erased_visit_fn;
9#[cfg(all(test, any(nm_shard_all, nm_shard_0)))]
10mod erased_visit_fn_tests;
11#[doc(hidden)]
12pub mod erased_visit_mut;
13#[cfg(all(test, any(nm_shard_all, nm_shard_0)))]
14mod erased_visit_tests;
15mod fx;
16#[cfg(test)]
17pub(crate) mod test_support;
18
19pub mod annotation;
20pub mod bound_expr;
21pub mod catalog_hooks;
22pub mod conflict;
23pub mod dml;
24pub mod function_calls;
25pub mod idents;
26pub mod lock_inventory;
27pub mod locking;
28pub mod migration;
29pub mod migration_order;
30pub mod numeric_literal;
31pub mod offset;
32pub mod order;
33mod output_label;
34pub mod parse;
35pub mod predicate_normalization;
36pub mod schema;
37pub mod source;
38pub mod sql_include_policy;
39pub mod sql_names;
40pub mod star_projection;
41pub mod statement_facts;
42pub mod statements;
43pub mod types;
44
45pub use annotation::{leading_query_annotation, sql_requires_query_annotation};
46pub use bound_expr::canonical_bound_expr;
47pub use catalog_hooks::{
48    CatalogLifecycleLookup, CatalogTriggerWrite, SearchPathResolution, TriggerEvent,
49};
50pub use conflict::{
51    analyze_conflict_inserts, analyze_conflict_inserts_with_binds, expression_is_constant,
52    SqlConflictInsertFact, SqlConflictTarget, SqlInsertSourceShape, SqlPinnedJoinEquality,
53    SqlPinnedRelation, SqlPinnedSource, SqlSourceRelation,
54};
55pub use dml::{
56    extract_dml_write_targets, find_generated_column_writes, GeneratedColumnWrite, GeneratedTable,
57    GeneratedTableColumns,
58};
59pub use function_calls::{SqlFunctionCallFact, SqlFunctionClause};
60pub use locking::{
61    extract_locking_select_metadata, extract_locking_select_metadata_with_placeholders,
62    JoinEquality, LockingSelectMetadata,
63};
64pub use migration::extract_migration_facts;
65pub use offset::{
66    sql_file_offset_uses, sql_has_offset_clause, sql_offset_uses, OffsetUse, SqlOffsetFact,
67};
68pub use order::{canonical_order_keys, order_by_ascending, CanonicalOrderKey};
69pub use parse::{parse_postgres_expression, parse_postgres_sql, PostgresParseError};
70pub use schema::extract_create_table_metadata;
71pub use source::*;
72pub use sql_names::decoded_parts;
73pub use statement_facts::SqlLifecycleFacts;
74#[doc(hidden)]
75pub use statement_facts::{SqlLifecycleBatch, SqlLifecycleStep, SqlViewReads};
76pub use statements::{
77    extract_sql_statement_facts, has_top_level_not_exists_in, insert_keyword_count,
78    mask_quoted_sql, SqlAssignmentFact, SqlBareRead, SqlBoundFact, SqlBoundInputMode, SqlBoundItem,
79    SqlBoundItemKind, SqlBoundKind, SqlBoundOutput, SqlBoundPin, SqlBoundQuery, SqlColumnClause,
80    SqlColumnUseFact, SqlConflictArbiter, SqlConflictWhereProof, SqlConjunctFact,
81    SqlCountExistenceFact, SqlCursorBound, SqlExistsSetOpFact, SqlInsertFact, SqlLimitFact,
82    SqlLimitValue, SqlOnConflictAction, SqlOnConflictFact, SqlPinSource, SqlQualifiedRead,
83    SqlQualifiedScope, SqlRelationPredicateFact, SqlScalarReads, SqlSelectFact,
84    SqlStatementFileFacts, SqlSweepFact, SqlTriggerEvent, SqlTriggerFact, SqlTriggerPeriod,
85    SqlValueForm, SqlWriteColumns, SqlWriteFact,
86};
87pub use types::{
88    PostgresFactError, PostgresSchemaOptions, SqlAddColumnMetadata, SqlColumnMetadata,
89    SqlCreateIndexMetadata, SqlCreateTableMetadata, SqlDeclaredIdentifier, SqlDropIndexMetadata,
90    SqlForeignKeyMetadata, SqlIndexParam, SqlNamedConstraint, SqlSchemaFileFacts, SqlSettingUse,
91    SqlStatementKind, SqlTableSchemaEvent, SqlUnanalyzableStatement, SqlUnnamedConstraint,
92};
93#[doc(hidden)]
94pub use types::{SqlComplexQuery, SqlPolicyClause, SqlPolicyClauseUse, SqlQueryComplexity};
95
96#[doc(hidden)]
97pub mod usage;