Skip to content
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
34 changes: 17 additions & 17 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion examples/portal_corp_extension/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tracing::info;

use postgresql_embedded::{PostgreSQL, Settings, VersionReq};

/// Example of how to install and configure the PortalCorp pgvector extension.
/// Example of how to install and configure the `PortalCorp` pgvector extension.
///
/// See: <https://github.com/pgvector/pgvector?tab=readme-ov-file#getting-started>
#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion examples/tensor_chord_extension/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use tracing::info;

use postgresql_embedded::{PostgreSQL, Settings, VersionReq};

/// Example of how to install and configure the TensorChord vector extension.
/// Example of how to install and configure the `TensorChord` vector extension.
///
/// See: <https://github.com/tensorchord/pgvecto.rs/?tab=readme-ov-file#quick-start>
#[tokio::main]
Expand Down
27 changes: 14 additions & 13 deletions postgresql_embedded/src/postgresql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ impl PostgreSQL {
// conflicts with other versions. This will also facilitate setting the status of the
// server to the correct initial value. If the minor and release version are not set, the
// installation directory will be determined dynamically during the installation process.
if !postgresql.settings.trust_installation_dir {
if let Some(version) = postgresql.settings.version.exact_version() {
let path = &postgresql.settings.installation_dir;
let version_string = version.to_string();

if !path.ends_with(&version_string) {
postgresql.settings.installation_dir =
postgresql.settings.installation_dir.join(version_string);
}
if !postgresql.settings.trust_installation_dir
&& let Some(version) = postgresql.settings.version.exact_version()
{
let path = &postgresql.settings.installation_dir;
let version_string = version.to_string();

if !path.ends_with(&version_string) {
postgresql.settings.installation_dir =
postgresql.settings.installation_dir.join(version_string);
}
}
postgresql
Expand Down Expand Up @@ -103,10 +103,11 @@ impl PostgreSQL {
.file_name()
.and_then(|file_name| Version::parse(&file_name.to_string_lossy()).ok());
// If this directory matches the version requirement, we're done.
if let Some(path_version) = maybe_path_version {
if self.settings.version.matches(&path_version) && path.exists() {
return Some(path.clone());
}
if let Some(path_version) = maybe_path_version
&& self.settings.version.matches(&path_version)
&& path.exists()
{
return Some(path.clone());
}

// Get all directories in the path as versions.
Expand Down
12 changes: 6 additions & 6 deletions postgresql_embedded/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ impl Settings {
}
let configuration_prefix = "configuration.";
for (key, value) in &query_parameters {
if key.starts_with(configuration_prefix) {
if let Some(configuration_key) = key.strip_prefix(configuration_prefix) {
settings
.configuration
.insert(configuration_key.to_string(), value.to_string());
}
if key.starts_with(configuration_prefix)
&& let Some(configuration_key) = key.strip_prefix(configuration_prefix)
{
settings
.configuration
.insert(configuration_key.to_string(), value.to_string());
}
}

Expand Down