Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default transaction configuration params #1466

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ pub async fn configure(
C::Set(Set {
parameter: S::DefaultStatisticsTarget(ConfigStr { value }),
}) => set(cli, "default_statistics_target", None, value).await,
C::Set(Set {
parameter: S::DefaultTransactionIsolation(ConfigStr { value }),
}) => set(cli, "default_transcation_isolation", None, value).await,
C::Set(Set {
parameter: S::DefaultTransactionDeferrable(ConfigStr { value }),
}) => set(cli, "default_transaction_deferrable", None, value).await,
C::Set(Set {
parameter: S::DefaultTransactionAccessMode(ConfigStr { value }),
}) => set(cli, "default_transaction_access_mode", None, value).await,
C::Set(Set {
parameter: S::EffectiveIoConcurrency(ConfigStr { value }),
}) => set(cli, "effective_io_concurrency", None, value).await,
Expand Down Expand Up @@ -223,6 +232,9 @@ pub async fn configure(
C::MaintenanceWorkMem => "maintenance_work_mem",
C::EffectiveCacheSize => "effective_cache_size",
C::DefaultStatisticsTarget => "default_statistics_target",
C::DefaultTransactionAccessMode => "default_transaction_access_mode",
C::DefaultTransactionDeferrable => "default_transaction_deferrable",
C::DefaultTransactionIsolation => "default_transaction_isolation",
C::EffectiveIoConcurrency => "effective_io_concurrency",
C::SessionIdleTimeout => "session_idle_timeout",
C::SessionIdleTransactionTimeout => "session_idle_transaction_timeout",
Expand Down
26 changes: 26 additions & 0 deletions src/commands/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,26 @@ pub enum ValueParameter {
/// Corresponds to the PostgreSQL configuration parameter of the same name.
DefaultStatisticsTarget(ConfigStr),

/// Controls the default isolation level of each new transaction,
/// including implicit transactions. Defaults to `Serializable`.
/// Note that changing this to a lower isolation level implies
/// that the transactions are also read-only by default regardless
/// of the value of the `default_transaction_access_mode` setting.
DefaultTransactionIsolation(ConfigStr),

/// Controls the default deferrable status of each new transaction.
/// It currently has no effect on read-write transactions or those
/// operating at isolation levels lower than `Serializable`.
/// The default is `NotDeferrable`.
DefaultTransactionDeferrable(ConfigStr),

// Controls the default read-only status of each new transaction,
// including implicit transactions. Defaults to `ReadWrite`.
// Note that if `default_transaction_isolation` is set to any value
// other than Serializable this parameter is implied to be
// `ReadOnly` regardless of the actual value.
DefaultTransactionAccessMode(ConfigStr),

/// Sets the number of concurrent disk I/O operations that PostgreSQL
/// expects can be executed simultaneously.
///
Expand Down Expand Up @@ -642,6 +662,12 @@ pub enum ConfigParameter {
/// Reset PostgreSQL configuration parameter of the same name
DefaultStatisticsTarget,
/// Reset PostgreSQL configuration parameter of the same name
DefaultTransactionIsolation,
/// Reset PostgreSQL configuration parameter of the same name
DefaultTransactionDeferrable,
/// Reset PostgreSQL configuration parameter of the same name
DefaultTransactionAccessMode,
/// Reset PostgreSQL configuration parameter of the same name
EffectiveIoConcurrency,
/// Reset session idle timeout
SessionIdleTimeout,
Expand Down
Loading