message: added extra tests for macro creation
diff: # name: test/sql/catalog/function/test_macro_default_arg.test
  # group: [function]
  +statement ok
  +pragma enable_verification;
  +
  #statement ok
  -#pragma enable_verification;
  +#CREATE MACRO f(x := NULL) AS x+1;
  -statement ok
  -CREATE MACRO f(x := NULL) AS x+1;
  +#query I
  +#SELECT f();
  +#----
  +#NULL
  -query I
  -SELECT f();
  -----
  -NULL
  +#query I
  +#SELECT f(x := 41)
  +#----
  +#42
  -query I
  -SELECT f(x := 41)
  -----
  -42
  +#query I
  +#SELECT f(x := (SELECT 41));
  +#----
  +#42
  -query I
  -SELECT f(x := (SELECT 41));
  -----
  -42
  +#query I
  +#select f(x:=(select 1 a));
  +#----
  +#2
  -query I
  -select f(x:=(select 1 a));
  +#query I
  +#select f(x:=a) from(select 41)t(a);
  +#----
  +#42
  +
  +#statement ok
  +#create table t as select 41 a;
  +
  +#query I
  +#select f(x:=a) from t;
  +#----
  +#42
  +
  +statement error
  +create macro my_macro1(a, b := a) as a + b;
  ----
  -2
  +Binder Error: table "0_macro_parametersmy_macro1" has duplicate column name "a"
  +
  +statement ok
  +create table integers (a integer);
  +
  +statement ok
  +create macro my_macro2(a := i) as (
  + select min(a) from integers
  +);
  +
  +statement ok
  +insert into integers values (5), (10), (13)
  query I
  -select f(x:=a) from(select 41)t(a);
  +select my_macro2(can_not_be_empty)
  ----
  -42
  +5
  statement ok
  -create table t as select 41 a;
  +drop table integers;
  -query I
  -select f(x:=a) from t;
  +# The macro still exists, but points to a non existant table
  +statement error
  +select my_macro2(5);
  ----
  -42
  +Catalog Error: Table with name integers does not exist!
  