Skip to content

Commit

Permalink
Introduce environment variable POSTGRESQL_DEFAULT_TRANSACTION_ISOLATI…
Browse files Browse the repository at this point in the history
…ON (#25013)

Signed-off-by: Florian Kamella <florian.kamella@cronn.de>
  • Loading branch information
Florian Kamella committed Sep 8, 2023
1 parent 5a072a4 commit 3581fa3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [[ -n "${POSTGRESQL_EXTRA_FLAGS:-}" ]]; then
flags+=("${extra_flags[@]}")
fi

if [[ -n "${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" ]]; then
flags+=("-c" "default_transaction_isolation=$POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION")
fi

flags+=("$@")

cmd=$(command -v postgres)
Expand Down
8 changes: 8 additions & 0 deletions bitnami/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ Passing extra command-line flags to the postgresql service command is possible t

* `POSTGRESQL_EXTRA_FLAGS`: Flags to be appended to the `postgres` startup command. No defaults

#### Adjusting the default transaction isolation level

The default transaction isolation level in postgresql is `read committed`, the global default transaction isolation level can be changed using the environment variable `POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION`.

Possible values are: `read uncommitted`, `read committed`, `repeatable read` or `serializable`. For more details consult the documentation for `default_transaction_isolation` in <https://www.postgresql.org/docs/current/runtime-config-client.html>

*Note: Setting `default_transaction_isolation` via `POSTGRESQL_EXTRA_FLAGS` is currently only possible for transaction levels without white spaces in its name.*

### Initializing a new instance

When the container is executed for the first time, it will execute the files with extensions `.sh`, `.sql` and `.sql.gz` located at `/docker-entrypoint-initdb.d`.
Expand Down

0 comments on commit 3581fa3

Please sign in to comment.