-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Adding an extension option shouldn't delete a set value and promote unrecognized options #15919
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
Adding an extension option shouldn't delete a set value and promote unrecognized options #15919
Conversation
…recognized options
I think proposed behaviour does make sense, but requires changing also the loop here:
Since I think to bring this home either:
The first seems possibly to be simpler, but I might get messy / eventually trip someone that the iteration is not safe. Also currently IF a core extension (that has an autoloadable setting as registered) happened to ADD a different setting (and publish for a past DuckDB version that can't known of the setting existing), even though autoloading kicks in the config check will still fail. To properly test this I think the way would be adding a test storage extension, do not register it for autoloading, and check that a C++ based test happen to pass (where config options are set and attached database is |
Thanks Carlo. I think this still messy, but probably it's better to copy the list being iterated on in Regarding testing - remember that the extension need to be registered to the file db type to autoload before all of this kicks in. Any existing examples? |
I would go for some indirect testing on autoloading (say checking Testing the options for storage extensions is doable, but brittle, maybe it's fine as is. |
@carlopi I pushed the changes to the unrecognized options logic we discuss.
I'm probably still missing something stupid - are you saying that the CI for those extensions will check this and that's good enough? Note that you need something like python to even use unrecognized extensions and/or explicit CPP code that uses a map and the dedicated constructor for it rather than just construct a config and set what it wants on it) |
I was thinking of a c++ test that has the See for example the line here: https://github.com/duckdb/duckdb-postgres/blob/dc0957a3755ea058b047bf6381f5b2894b848e1f/src/postgres_extension.cpp#L162 where This would test the new behaviour of To run the test then it would be of:
I would need to check how to have such a test run in CI. |
I think this changeset is simple enough not to warrant adding a complex CI setup to test it. Thanks! |
Adding an extension option shouldn't delete a set value and promote unrecognized options (duckdb/duckdb#15919)
The current implementation of AddExtensionOption immediately sets the default value into the current config, which makes sense. However, if the extension in question is loaded as part of the main database type, and the the value is already set by the caller, the default value shouldn't override it. On top of it, it may be that the current value may be in
unrecognized_options
where config options get to for unknown options. Now that the extension is loaded and the option is configured, it is nice to get it from there as well automatically.PS I don't know how to test it other than by hand with our extension. Guidance welcome.