Skip to content

Commit b551319

Browse files
committed
Allow projections with constants or pass-through references in ExtractFilters
1 parent 28eecef commit b551319

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/mysql_scanner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static void MySQLScan(ClientContext &context, TableFunctionInput &data, DataChun
159159
}
160160

161161
static InsertionOrderPreservingMap<string> MySQLScanToString(TableFunctionToStringInput &input) {
162-
InsertionOrderPreservingMap<string> result;
162+
InsertionOrderPreservingMap<string> result;
163163
auto &bind_data = input.bind_data->Cast<MySQLBindData>();
164164
result["Table"] = bind_data.table.name;
165165
return result;

src/mysql_utils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ MySQLConnectionParameters MySQLUtils::ParseConnectionParameters(const string &ds
139139
} else if (val == "preferred") {
140140
result.ssl_mode = SSL_MODE_PREFERRED;
141141
} else {
142-
throw InvalidInputException("Invalid dsn - ssl mode must be either disabled, required, verify_ca, verify_identity or preferred - got %s", value);
142+
throw InvalidInputException("Invalid dsn - ssl mode must be either disabled, required, verify_ca, "
143+
"verify_identity or preferred - got %s",
144+
value);
143145
}
144146
} else if (key == "ssl_ca") {
145147
set_options.insert("ssl_ca");

src/storage/mysql_execute_query.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,20 @@ string ExtractFilters(PhysicalOperator &child, const string &statement) {
9292
} else {
9393
return result + " AND " + filter_str;
9494
}
95+
} else if (child.type == PhysicalOperatorType::PROJECTION) {
96+
auto &proj = child.Cast<PhysicalProjection>();
97+
for (auto &expr : proj.select_list) {
98+
switch (expr->type) {
99+
case ExpressionType::BOUND_REF:
100+
case ExpressionType::BOUND_COLUMN_REF:
101+
case ExpressionType::VALUE_CONSTANT:
102+
break;
103+
default:
104+
throw NotImplementedException("Unsupported expression type in projection - only simple deletes/updates "
105+
"are supported in the MySQL connector");
106+
}
107+
}
108+
return ExtractFilters(*child.children[0], statement);
95109
} else if (child.type == PhysicalOperatorType::TABLE_SCAN) {
96110
auto &table_scan = child.Cast<PhysicalTableScan>();
97111
if (!table_scan.table_filters) {

0 commit comments

Comments
 (0)