From f2fb8e225d9cc46134f3efb0d67dcc94bf0d5330 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Mon, 23 Sep 2024 16:09:38 -0700 Subject: [PATCH] feat: return a warning for unsupported postgres statement --- src/operator/src/statement.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/operator/src/statement.rs b/src/operator/src/statement.rs index 4dc43e0d92e9..7c76d0dcfffc 100644 --- a/src/operator/src/statement.rs +++ b/src/operator/src/statement.rs @@ -46,7 +46,7 @@ use datafusion_expr::LogicalPlan; use partition::manager::{PartitionRuleManager, PartitionRuleManagerRef}; use query::parser::QueryStatement; use query::QueryEngineRef; -use session::context::QueryContextRef; +use session::context::{Channel, QueryContextRef}; use session::table_name::table_idents_to_full_name; use snafu::{ensure, OptionExt, ResultExt}; use sql::statements::copy::{CopyDatabase, CopyDatabaseArgument, CopyTable, CopyTableArgument}; @@ -338,10 +338,18 @@ impl StatementExecutor { "CLIENT_ENCODING" => validate_client_encoding(set_var)?, _ => { - return NotSupportedSnafu { - feat: format!("Unsupported set variable {}", var_name), + // for postgres, we give unknown SET statements a warning with + // success, this is prevent the SET call becoming a blocker + // of connection establishment + // + if query_ctx.channel() == Channel::Postgres { + query_ctx.set_warning(format!("Unsupported set variable {}", var_name)); + } else { + return NotSupportedSnafu { + feat: format!("Unsupported set variable {}", var_name), + } + .fail(); } - .fail() } } Ok(Output::new_with_affected_rows(0))