Skip to content

Commit ab50765

Browse files
committed
chore: ignore pg_catalog schema in compound identifier
1 parent 1a26be2 commit ab50765

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

datafusion/core/src/sql/planner.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,22 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
18451845
Ok(Expr::ScalarVariable(ty, var_names))
18461846
} else {
18471847
match (var_names.pop(), var_names.pop()) {
1848-
(Some(name), Some(relation)) if var_names.is_empty() || (var_names.len() == 1 && var_names.pop().unwrap().to_lowercase() == "public") => {
1848+
(Some(name), Some(relation)) => {
1849+
if let Some(schema) = var_names.pop() {
1850+
if !var_names.is_empty() {
1851+
return Err(DataFusionError::NotImplemented(format!(
1852+
"Unsupported compound identifier '{:?}'",
1853+
var_names,
1854+
)));
1855+
}
1856+
let schema = schema.to_lowercase();
1857+
if !["public", "pg_catalog"].contains(&schema.as_str()) {
1858+
return Err(DataFusionError::NotImplemented(format!(
1859+
"Unsupported compound identifier '{:?}'",
1860+
schema,
1861+
)));
1862+
}
1863+
}
18491864
if let Some(f) = self.context.outer_query_context_schema.iter().find_map(|s| s.field_with_qualified_name(&relation, &name).ok()) {
18501865
return Ok(Expr::OuterColumn(f.data_type().clone(), Column {
18511866
relation: Some(relation),

0 commit comments

Comments
 (0)