catalog_version Action

Implement the catalog_version DoAction to provide version tracking for catalog changes and cache invalidation in DuckDB.

The catalog_version action returns the current version of the database catalog. DuckDB uses this version number to determine whether cached schema information is still valid. When the version changes, DuckDB refreshes the catalog metadata by re-querying the schemas.

Input Parameters

The action receives a single msgpack-serialized parameter:

struct AirportGetCatalogVersionParams
{
  string catalog_name;
  MSGPACK_DEFINE_MAP(catalog_name);
};

Return Value

The action must return a single msgpack-encoded structure:

struct GetCatalogVersionResult
{
  uint64_t catalog_version;
  bool is_fixed;
  MSGPACK_DEFINE_MAP(catalog_version, is_fixed)
};

If the is_fixed field is true, DuckDB will cache the returned catalog version and will not query the server for it again during the current session. If false, DuckDB may periodically check for version changes to detect schema updates.