Skip to content

Commit

Permalink
add feature gate
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkMyCar committed Jan 3, 2025
1 parent ac2e13b commit 8c24909
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sql/src/plan/statement/dml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ use crate::plan::{
PlanError, QueryContext, ReadThenWritePlan, SelectPlan, SubscribeFrom, SubscribePlan,
};
use crate::plan::{with_options, CopyFromSource};
use crate::session::vars;
use crate::session::vars::{self, ENABLE_COPY_FROM_REMOTE};

// TODO(benesch): currently, describing a `SELECT` or `INSERT` query
// plans the whole query to determine its shape and parameter types,
Expand Down Expand Up @@ -1117,6 +1117,8 @@ fn plan_copy_from(
let source = match target {
CopyTarget::Stdin => CopyFromSource::Stdin,
CopyTarget::Expr(from) => {
scx.require_feature_flag(&ENABLE_COPY_FROM_REMOTE)?;

// Converting the to expr to a HirScalarExpr
let mut from_expr = from.clone();
transform_ast::transform(scx, &mut from_expr)?;
Expand Down
6 changes: 6 additions & 0 deletions src/sql/src/session/vars/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2182,6 +2182,12 @@ feature_flags!(
default: false,
enable_for_item_parsing: true,
},
{
name: enable_copy_from_remote,
desc: "Whether to allow COPY FROM <url>.",
default: false,
enable_for_item_parsing: false,
},
);

impl From<&super::SystemVars> for OptimizerFeatures {
Expand Down

0 comments on commit 8c24909

Please sign in to comment.