Comments (2)
Hi @arjenpdevries, thanks for the bug report!
This is currently expected behavior. We make a distinction between positional and named parameters. Positional parameters can only be used positionally, and named parameters can only be used by supplying their name.
This will work:
D create or replace macro test(a := 'auto') AS a;
D select test(a:='fiets');
┌────────────────────┐
│ test(a := 'fiets') │
│ varchar │
├────────────────────┤
│ fiets │
└────────────────────┘
Or this will work:
D create or replace macro test(a) AS a;
D select test('fiets');
┌───────────────┐
│ test('fiets') │
│ varchar │
├───────────────┤
│ fiets │
└───────────────┘
And this will also work:
D create or replace macro test(a, b := 'fiets') AS (a, b);
D select test('auto');
┌────────────────────────────┐
│ test('auto') │
│ struct( varchar, varchar) │
├────────────────────────────┤
│ {'': auto, '': fiets} │
└────────────────────────────┘
But this won't:
D select test('fiets', 'auto');
Error: Binder Error: Macro function 'test(a)' requires a single positional argument, but 2 positional arguments were provided.
LINE 1: select test('fiets', 'auto');
^
Named parameters always come after positional parameters (like in Python).
However, I realise that Python accepts positional parameters even when they have a default:
>>> def test(a='auto'):
... return a
...
>>> test('fiets')
'fiets'
Perhaps we can add this functionality as well.
from duckdb.
Ah thanks for the clear explanation! I see now how this is expected.
from duckdb.
Related Issues (20)
- Lists leak disk space in persistent databases. HOT 5
- Connecting from SAS via SAS/ACCESS Interface to JDBC throws multiple ERROR: java.sql.SQLFeatureNotSupportedException: HOT 5
- UDF with type arrow unexpectedly requires alphabetical ordering of returned struct field HOT 2
- Window function results should not be affected by row order when using INTERVAL RANGE with dates HOT 1
- STRING_SPLIT_REGEX(..., `\b`) doesn't work? HOT 3
- Random segfault running a query against CSV files HOT 17
- Out of memory when processing 600M rows HOT 5
- Unable detect 'date' datatype from a csv file HOT 3
- read_json_auto schema detection inconsistency HOT 4
- JVM crash with exit code 134 when executing a query HOT 4
- Incorrect parquet dataPageOffset written HOT 4
- Excel is launched after quitting cli HOT 2
- ignore_errors=true doesn't read any row but ignore_errors=false does. HOT 2
- Swift API not suitable for large dataset retrieval HOT 6
- DuckDB can load a large CSV in memory but get out-of-memory error when trying to save it as a parquet file HOT 3
- Building static library for Conan produces a version stub instead of the corresponding DuckDB version HOT 5
- "FATAL Error: fsync failed!" when `COPY ... TO "/dev/stdout"` called through nodejs script HOT 2
- Unable to install extensions in Windows when using Julia HOT 7
- Attempted to register an already registered secret type 's3' HOT 3
- Writing parquet with large strings runs out of memory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from duckdb.