Skip to content

Commit 4fa88dd

Browse files
committedJan 21, 2025
duckdb_extensions(): Fixup shell and autocomplete versioning
1 parent f1c115d commit 4fa88dd

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed
 

‎extension/autocomplete/autocomplete_extension.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,7 @@ std::string AutocompleteExtension::Name() {
481481
}
482482

483483
std::string AutocompleteExtension::Version() const {
484-
#ifdef EXT_VERSION_AUTOCOMPLETE
485-
return EXT_VERSION_AUTOCOMPLETE;
486-
#else
487-
return "";
488-
#endif
484+
return DefaultVersion();
489485
}
490486

491487
} // namespace duckdb
@@ -496,7 +492,7 @@ DUCKDB_EXTENSION_API void autocomplete_init(duckdb::DatabaseInstance &db) {
496492
}
497493

498494
DUCKDB_EXTENSION_API const char *autocomplete_version() {
499-
return duckdb::DuckDB::LibraryVersion();
495+
return duckdb::AutocompleteExtension::DefaultVersion();
500496
}
501497
}
502498

‎src/include/duckdb/main/extension.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Extension {
2424
DUCKDB_API virtual std::string Version() const {
2525
return "";
2626
}
27+
DUCKDB_API static const char *DefaultVersion();
2728
};
2829

2930
enum class ExtensionABIType : uint8_t {

‎src/main/extension.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,11 @@ bool VersioningUtils::ParseSemver(string &semver, idx_t &major_out, idx_t &minor
137137
return true;
138138
}
139139

140+
const char *Extension::DefaultVersion() {
141+
if (ExtensionHelper::IsRelease(DuckDB::LibraryVersion())) {
142+
return DuckDB::LibraryVersion();
143+
}
144+
return DuckDB::SourceID();
145+
}
146+
140147
} // namespace duckdb

‎tools/sqlite3_api_wrapper/include/shell_extension.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ShellExtension : public Extension {
1616
public:
1717
void Load(DuckDB &db) override;
1818
std::string Name() override;
19+
std::string Version() const override;
1920
};
2021

2122
} // namespace duckdb

‎tools/sqlite3_api_wrapper/shell_extension.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ std::string ShellExtension::Name() {
3838
return "shell";
3939
}
4040

41+
std::string ShellExtension::Version() const {
42+
return DefaultVersion();
43+
}
44+
4145
} // namespace duckdb

0 commit comments

Comments
 (0)