Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store unqualified macro parameters, qualify before binding #10266

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix internal issue 1044
  • Loading branch information
lnkuiper committed Jan 18, 2024
commit d5c1320fd79c13b4b213b1f230b82af0dbc92daf
2 changes: 1 addition & 1 deletion src/planner/binder/statement/bind_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ SchemaCatalogEntry &Binder::BindCreateFunctionInfo(CreateInfo &info) {
}
auto this_macro_binding = make_uniq<DummyBinding>(dummy_types, dummy_names, base.name);
macro_binding = this_macro_binding.get();
ExpressionBinder::QualifyColumnNames(*this, scalar_function.expression);

// create a copy of the expression because we do not want to alter the original
auto expression = scalar_function.expression->Copy();
ExpressionBinder::QualifyColumnNames(*this, expression);

// bind it to verify the function was defined correctly
string error;
Expand Down
21 changes: 21 additions & 0 deletions test/sql/catalog/function/test_simple_macro.test
Original file line number Diff line number Diff line change
Expand Up @@ -323,3 +323,24 @@ SELECT my_macro(x := 42);
statement error
SELECT my_macro(a := 42, a := 42);
----

# internal issue 1044
statement ok
create macro zz1(x) as (select 10+x);

statement ok
create macro zz2(x) as 20+x;

query II
select zz1(1),zz2(2);
----
a

# should not return any results
query III
select function_name, parameters, macro_definition
from duckdb_functions()
where function_name like 'zz%'
and macro_definition not like '%macro_parameters%';
----