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 schemas;
23#[cfg(feature = "schemas")]
24pub use schemas::{get_schemas, publication_info};
25#[cfg(feature = "tunnel")]
26pub mod tunnel;
27#[cfg(feature = "tunnel")]
28pub use tunnel::{Client, Config, DEFAULT_SNAPSHOT_STATEMENT_TIMEOUT, TunnelConfig};
29
30pub mod query;
31pub use mz_ore::sql;
32pub use query::{
33 Sql, SqlFormatError, batch_execute, execute, execute_prepared, query, query_one,
34 query_one_prepared, query_opt, query_opt_prepared, query_prepared, simple_query,
35 simple_query_opt,
36};
37
38#[derive(Debug, thiserror::Error)]
40pub enum PostgresError {
41 #[error(transparent)]
43 Generic(#[from] anyhow::Error),
44 #[cfg(feature = "tunnel")]
46 #[error("error setting up ssh: {0}")]
47 Ssh(#[source] anyhow::Error),
48 #[error("error communicating with ssh tunnel: {0}")]
50 SshIo(std::io::Error),
51 #[error("IO error in connection: {0}")]
53 Io(#[from] std::io::Error),
54 #[error(transparent)]
56 Postgres(#[from] tokio_postgres::Error),
57 #[error(transparent)]
59 PostgresSsl(#[from] openssl::error::ErrorStack),
60 #[error("query returned more rows than expected")]
61 UnexpectedRow,
62 #[error("publication {0} does not exist")]
67 PublicationMissing(String),
68 #[error("one or more tables requires BYPASSRLS: {0:?}")]
69 BypassRLSRequired(Vec<String>),
70}