1#[cfg(feature = "replication")]
13pub mod replication;
14#[cfg(feature = "replication")]
15pub use replication::{
16 available_replication_slots, drop_replication_slots, fetch_max_lsn, get_is_in_recovery,
17 get_max_wal_senders, get_timeline_id, get_wal_level, validate_no_rls_policies,
18};
19#[cfg(feature = "schemas")]
20pub mod desc;
21#[cfg(feature = "schemas")]
22pub mod schema_change;
23#[cfg(feature = "schemas")]
24pub mod schemas;
25#[cfg(feature = "schemas")]
26pub use schemas::{get_schemas, publication_info};
27#[cfg(feature = "tunnel")]
28pub mod tunnel;
29#[cfg(feature = "tunnel")]
30pub use tunnel::{Client, Config, DEFAULT_SNAPSHOT_STATEMENT_TIMEOUT, TunnelConfig};
31
32pub mod query;
33pub use mz_ore::sql;
34pub use query::{
35 Sql, SqlFormatError, batch_execute, execute, execute_prepared, query, query_one,
36 query_one_prepared, query_opt, query_opt_prepared, query_prepared, simple_query,
37 simple_query_opt,
38};
39
40#[derive(Debug, thiserror::Error)]
42pub enum PostgresError {
43 #[error(transparent)]
45 Generic(#[from] anyhow::Error),
46 #[cfg(feature = "tunnel")]
48 #[error("error setting up ssh: {0}")]
49 Ssh(#[source] anyhow::Error),
50 #[error("error communicating with ssh tunnel: {0}")]
52 SshIo(std::io::Error),
53 #[error("IO error in connection: {0}")]
55 Io(#[from] std::io::Error),
56 #[error(transparent)]
58 Postgres(#[from] tokio_postgres::Error),
59 #[error(transparent)]
61 PostgresSsl(#[from] openssl::error::ErrorStack),
62 #[error("query returned more rows than expected")]
63 UnexpectedRow,
64 #[error("publication {0} does not exist")]
69 PublicationMissing(String),
70 #[error("one or more tables requires BYPASSRLS: {0:?}")]
71 BypassRLSRequired(Vec<String>),
72}