From 9311624212234a6a7e74b2cb47723f4212c20f3b Mon Sep 17 00:00:00 2001 From: Runji Wang Date: Thu, 16 Mar 2023 16:32:30 +0800 Subject: [PATCH] feat: support pgoptions (#173) * support pgoptions Signed-off-by: Runji Wang * bump version Signed-off-by: Runji Wang * fix clippy Signed-off-by: Runji Wang --------- Signed-off-by: Runji Wang --- CHANGELOG.md | 4 ++++ Cargo.lock | 6 +++--- Cargo.toml | 2 +- sqllogictest-bin/src/engines.rs | 3 +++ sqllogictest-bin/src/lib.rs | 16 +++++++++------- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d7b8fc..ba286a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.13.1] - 2023-03-16 + +* Support postgres options. + ## [0.13.0] - 2023-02-15 * `sqllogictest-bin` now uses the strict validator to update records (the runner still doesn't check schema). diff --git a/Cargo.lock b/Cargo.lock index 2e3d78f..0340df9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1424,7 +1424,7 @@ dependencies = [ [[package]] name = "sqllogictest" -version = "0.13.0" +version = "0.13.1" dependencies = [ "async-trait", "educe", @@ -1445,7 +1445,7 @@ dependencies = [ [[package]] name = "sqllogictest-bin" -version = "0.13.0" +version = "0.13.1" dependencies = [ "anyhow", "async-trait", @@ -1466,7 +1466,7 @@ dependencies = [ [[package]] name = "sqllogictest-engines" -version = "0.13.0" +version = "0.13.1" dependencies = [ "async-trait", "bytes", diff --git a/Cargo.toml b/Cargo.toml index 45d28a3..405cdc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ members = ["examples/*", "sqllogictest", "sqllogictest-bin", "sqllogictest-engines", "tests"] [workspace.package] -version = "0.13.0" +version = "0.13.1" edition = "2021" homepage = "https://github.com/risinglightdb/sqllogictest-rs" keywords = ["sql", "database", "parser", "cli"] diff --git a/sqllogictest-bin/src/engines.rs b/sqllogictest-bin/src/engines.rs index b6506ea..3223bbe 100644 --- a/sqllogictest-bin/src/engines.rs +++ b/sqllogictest-bin/src/engines.rs @@ -40,6 +40,9 @@ impl From<&DBConfig> for PostgresConfig { .dbname(&config.db) .user(&config.user) .password(&config.pass); + if let Some(options) = &config.options { + pg_config.options(options); + } pg_config } diff --git a/sqllogictest-bin/src/lib.rs b/sqllogictest-bin/src/lib.rs index f582f32..fd04f47 100644 --- a/sqllogictest-bin/src/lib.rs +++ b/sqllogictest-bin/src/lib.rs @@ -20,20 +20,15 @@ use sqllogictest::{ Record, Runner, }; -#[derive(Copy, Clone, Debug, PartialEq, Eq, ArgEnum)] +#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, ArgEnum)] #[must_use] pub enum Color { + #[default] Auto, Always, Never, } -impl Default for Color { - fn default() -> Self { - Color::Auto - } -} - #[derive(Parser, Debug, Clone)] #[clap(about, version, author)] struct Opt { @@ -88,6 +83,9 @@ struct Opt { /// The database password. #[clap(short = 'w', long, default_value = "postgres")] pass: String, + /// The database options. + #[clap(long)] + options: Option, /// Overrides the test files with the actual output of the database. #[clap(long)] @@ -108,6 +106,8 @@ struct DBConfig { user: String, /// The database password. pass: String, + /// Command line options. + options: Option, } impl DBConfig { @@ -134,6 +134,7 @@ pub async fn main_okk() -> Result<()> { db, user, pass, + options, r#override, format, } = Opt::parse(); @@ -189,6 +190,7 @@ pub async fn main_okk() -> Result<()> { db, user, pass, + options, }; if r#override || format {