280824 {
280825 const string engine_platform = string(DuckDB::Platform());
280826
280827 if (!AppearsValid()) {
280828 return "The file is not a DuckDB extension. The metadata at the end of the file is invalid";
280829 }
280830
280831 string result;
280832
280833
280836
280837 if (engine_version != duckdb_version) {
280838 result +=
StringUtil::Format(
"The file was built specifically for DuckDB version '%s' and can only be "
280839 "loaded with that version of DuckDB. (this version of DuckDB is '%s')",
280840 PrettyPrintString(duckdb_version), engine_version);
280841 }
280842
280844 idx_t major, minor, patch;
280846 result +=
StringUtil::Format(
"The file was built for DuckDB C API version '%s', which failed to parse as a "
280847 "recognized version string",
280848 duckdb_capi_version, DUCKDB_EXTENSION_API_VERSION_MAJOR);
280849 } else if (major != DUCKDB_EXTENSION_API_VERSION_MAJOR) {
280850
280851 result +=
280852 StringUtil::Format(
"The file was built for DuckDB C API version '%s', but we can only load extensions "
280853 "built for DuckDB C API 'v%lld.x.y'.",
280854 duckdb_capi_version, DUCKDB_EXTENSION_API_VERSION_MAJOR);
280856 result +=
280857 StringUtil::Format(
"The file was built for DuckDB C API version '%s', but we can only load extensions "
280858 "built for DuckDB C API 'v%lld.%lld.%lld' and lower.",
280859 duckdb_capi_version, DUCKDB_EXTENSION_API_VERSION_MAJOR,
280860 DUCKDB_EXTENSION_API_VERSION_MINOR, DUCKDB_EXTENSION_API_VERSION_PATCH);
280861 }
280862 } else {
280863 throw InternalException("Unknown ABI type for extension: '%s'", extension_abi_metadata);
280864 }
280865
280866 if (engine_platform != platform) {
280867 if (!result.empty()) {
280868 result += " Also, t";
280869 } else {
280870 result += "T";
280871 }
280873 "he file was built for the platform '%s', but we can only load extensions built for platform '%s'.",
280874 PrettyPrintString(platform), engine_platform);
280875 }
280876
280877 return result;
280878}
static const string GetVersionDirectoryName()
For tagged releases we use the tag, else we use the git commit hash.
Definition duckdb.cpp:279168
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
@ CPP
Uses C++ ABI, version needs to match precisely.
Definition duckdb.hpp:43805
@ C_STRUCT
Uses C ABI using the duckdb_ext_api_v1 struct, version needs to be equal or higher.
Definition duckdb.hpp:43807
@ C_STRUCT_UNSTABLE
Uses C ABI using the duckdb_ext_api_v1 struct including "unstable" functions, version needs to match ...
Definition duckdb.hpp:43809
static bool ParseSemver(string &semver, idx_t &major_out, idx_t &minor_out, idx_t &patch_out)
Note: only supports format v{major}.{minor}.{patch}.
Definition duckdb.cpp:280905
static bool IsSupportedCAPIVersion(string &capi_version_string)
Note: only supports format v{major}.{minor}.{patch}.
Definition duckdb.cpp:280880