Fix crash in the shell caused by printing blobs that failed to cast #13983
+10
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using the (undocumented)
.dump
command in the shell, while opening a database that contains blob-aliased types provided by an extension that is unloaded, the CLI would crash as the shell would detect a value to be present, but the the unknown type would fail to cast to BLOB (as the extension, and thus any cast functions are not available) and return a nullptr.I've modified the shell and the sqlite3 api wrapper to handle this case, but I'm not sure if this is the best fix or what the intended behavior should be when interacting with unknown types from the sqlite api. If we were to fall-back into a reinterpret cast, im not sure that's desirable when casting within the
sqlite3_column_has_value
as the type check then become essentially meaningless. Also there is no guarantee that the extension in question actually provides a valid reverse cast from the underlying type (e.g. BLOB) to the extension type even when loaded. It feels like the only sane thing is to either error out or turn all unknown types to NULL.Closes duckdb/duckdb-spatial#391